diff options
-rw-r--r-- | runtime/doc/api.txt | 9 | ||||
-rw-r--r-- | src/nvim/api/vim.c | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index fdabb0da50..67260904a6 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -729,6 +729,15 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* On execution error: does not fail, but updates v:errmsg. + If you need to input sequences like <C-o> use nvim_replace_termcodes + to replace the termcodes and then pass the resulting string to + nvim_feedkeys. You'll also want to enable escape_csi. + + Example: > + :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true) + :call nvim_feedkeys(key, 'n', v:true) +< + Parameters: ~ {keys} to be typed {mode} behavior flags, see |feedkeys()| diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 40cef87cf0..d6f95c7a5f 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -203,6 +203,16 @@ Integer nvim_get_hl_id_by_name(String name) /// flags. This is a blocking call, unlike |nvim_input()|. /// /// On execution error: does not fail, but updates v:errmsg. +// +// If you need to input sequences like <C-o> use nvim_replace_termcodes +// to replace the termcodes and then pass the resulting string to +// nvim_feedkeys. You'll also want to enable escape_csi. +/// +/// Example: +/// <pre> +/// :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true) +/// :call nvim_feedkeys(key, 'n', v:true) +/// </pre> /// /// @param keys to be typed /// @param mode behavior flags, see |feedkeys()| |