Can remote-send trigger Tab-completion?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Can remote-send trigger Tab-completion?

Ivan Brennan
I'm sending keys from a shell to a running Vim instance using the "--remote-send" option. I want to trigger Tab-completion on Vim's command line (e.g. `vim --remote-send ":ed<Tab>"` -> ":edit") but it ends up inserting a Tab character rather than completing the command (":ed^I" rather than ":edit"). Is there a way to do this?

The reason I'm doing this in the first place is I'm using Vimrunner (https://github.com/AndrewRadev/vimrunner) to write integration tests for a Vim plugin I'm building. I ran into this problem using Vimrunner's api to interact with Vim, and under the hood it's using Vim's client/server remote functionality. I tried it directly in the shell and got the same results.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Can remote-send trigger Tab-completion?

Jacky Liu
On Monday, May 4, 2015 at 9:43:26 PM UTC+8, Ivan wrote:
> I'm sending keys from a shell to a running Vim instance using the "--remote-send" option. I want to trigger Tab-completion on Vim's command line (e.g. `vim --remote-send ":ed<Tab>"` -> ":edit") but it ends up inserting a Tab character rather than completing the command (":ed^I" rather than ":edit"). Is there a way to do this?
>
> The reason I'm doing this in the first place is I'm using Vimrunner (https://github.com/AndrewRadev/vimrunner) to write integration tests for a Vim plugin I'm building. I ran into this problem using Vimrunner's api to interact with Vim, and under the hood it's using Vim's client/server remote functionality. I tried it directly in the shell and got the same results.


maybe you can use the remote-eval feature together with the "feedkeys()" function to replace remote-send, because AFAIK this function "feedkeys()" completely simulate user key strokes without any subtle background tricks.

regards ~

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Can remote-send trigger Tab-completion?

Ivan Brennan
In reply to this post by Ivan Brennan
On Monday, May 4, 2015 at 9:43:26 AM UTC-4, Ivan wrote:
> I'm sending keys from a shell to a running Vim instance using the "--remote-send" option. I want to trigger Tab-completion on Vim's command line (e.g. `vim --remote-send ":ed<Tab>"` -> ":edit") but it ends up inserting a Tab character rather than completing the command (":ed^I" rather than ":edit"). Is there a way to do this?
>
> The reason I'm doing this in the first place is I'm using Vimrunner (https://github.com/AndrewRadev/vimrunner) to write integration tests for a Vim plugin I'm building. I ran into this problem using Vimrunner's api to interact with Vim, and under the hood it's using Vim's client/server remote functionality. I tried it directly in the shell and got the same results.

Awesome! feedkeys() was the answer. What finally worked from the shell was:
--remote-send ':call feedkeys(":ed\<Tab>", "t")\<CR>'

and in ruby, using Vimrunner:
vim = Vimrunner.start
vim.feedkeys ':call feedkeys(":ed\<Tab>", "t")\<CR>'

Thanks a million!

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Can remote-send trigger Tab-completion?

Ivan Brennan
Actually, the vimrunner version can be shortened to:
vim.command(%q{call feedkeys(":ed\<Tab>", "t")})

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.