I want to be able to control vim/neovim on a per-key basis with python scripting. There is a function called feedkeys in the python vim module (vim.feedkeys) that is nearly what I want. However, I haven't been able to figure out how to send things like function keys, arrow keys, pgup, pgdown etc as it always takes my strings completely literally.
As per the documentation for vim's feedkeys (vimscript version, not python)
feedkeys("\<CR>") simulates pressing of the <Enter> key. But feedkeys('\<CR>') pushes 5 characters.
Things I've tried with the python counterpart that haven't worked (note, <CR> is just an example; I know I can use \n for that. Nonetheless, this should simulate an enter keypress):
vim.feedkeys("\<CR>") vim.feedkeys("<CR>") vim.feedkeys("\<CR\>") vim.call("feedkeys", "\<CR>") vim.call("feedkeys", '"\<CR>"') All of these were interpreted literally. I want to do something like vim.feedkeys("\<F5>") etc. Any ideas?
没有评论:
发表评论