Hi Gelondia,
You can use vim.eval to feed keys Actually you can call any function
that vim provides through vim.eval. Have a look at :h functions for
more information. The solution for your problem would look like this:
vim.eval("feedkeys('y', 'n')")
Cheers,
Jan Christoph
On Nov 11, 8:31 pm, Gelonida N <[email protected]> wrote:
> Hi.
>
> Let's assume I'd like to simulate user key strokes from a python script.
> How could I do this?
>
> What I wanted to do.
> - create a visual selection in gvim.
> - then run a python script via a gvim menu entry.
>
> In this example I just wanted to simulate pressing 'y' in order to yank
> the visual selection into register-0
>
> vim.eval() and vim.command() don't seem to be apropriate.
>
> For above example there are probably other means, other commands, but I
> wanted to know if I can simulate key strokes in all the situations,
> where I do not find a more elegant / straight solution due to my lack of
> vim scripting.(basically all I know is from ':help python')
>
> Thanks in advance for any tips / hints
--
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