diff options
Diffstat (limited to 'runtime/doc/api.txt')
-rw-r--r-- | runtime/doc/api.txt | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 46e1c12090..ed6e4905b4 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -810,43 +810,38 @@ nvim_get_keymap({mode}) *nvim_get_keymap()* nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()* Sets a global |mapping| for the given mode. - To set a buffer-local mapping, use |nvim_buf_set_keymap|. + To set a buffer-local mapping, use |nvim_buf_set_keymap()|. - Unlike ordinary Ex mode |:map| commands, special characters - like literal spaces and newlines are treated as an actual part - of the {lhs} or {rhs}. An empty {rhs} is treated like a - |<Nop>|. |keycodes| are still replaced as usual. + Unlike |:map|, leading/trailing whitespace is accepted as part + of the {lhs} or {rhs}. Empty {rhs} is |<Nop>|. |keycodes| are + replaced as usual. - `call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})` - - Is equivalent to, + Example: > + call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true}) +< - `nmap <nowait> <Space><NL> <Nop>` + is equivalent to: > + nmap <nowait> <Space><NL> <Nop> +< Parameters: ~ - {mode} Mode short-name (the first character of an map - command, e.g. "n", "i", "v", "x", etc.) OR the - string "!" (for |:map!|). |:map| can be - represented with a single space " ", an empty - string, or "m". + {mode} Mode short-name (map command prefix: "n", "i", + "v", "x", …) or "!" for |:map!|, or empty string + for |:map|. {lhs} Left-hand-side |{lhs}| of the mapping. {rhs} Right-hand-side |{rhs}| of the mapping. - {opts} |dict| of optional parameters. Accepts all + {opts} Optional parameters map. Accepts all |:map-arguments| as keys excluding |<buffer>| but - also including |noremap|. Values should all be - Booleans. Unrecognized keys will result in an - error. + including |noremap|. Values are Booleans. Unknown + key is an error. nvim_del_keymap({mode}, {lhs}) *nvim_del_keymap()* - Unmap a global |mapping| for the given mode. + Unmaps a global |mapping| for the given mode. - To unmap a buffer-local mapping, use |nvim_buf_del_keymap|. + To unmap a buffer-local mapping, use |nvim_buf_del_keymap()|. - Arguments are handled like |nvim_set_keymap|. Like with - ordinary |:unmap| commands (and `nvim_set_keymap` ), the given - {lhs} is interpreted literally: for instance, trailing - whitespace is treated as part of the {lhs}. |keycodes| are - still replaced as usual. + See also: ~ + |nvim_set_keymap()| nvim_get_commands({opts}) *nvim_get_commands()* Gets a map of global (non-buffer-local) Ex commands. @@ -1339,16 +1334,22 @@ nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()* *nvim_buf_set_keymap()* nvim_buf_set_keymap({buffer}, {mode}, {lhs}, {rhs}, {opts}) - Like |nvim_set_keymap|, but for a specific buffer. + Sets a buffer-local |mapping| for the given mode. Parameters: ~ - {buffer} Buffer handle, or 0 for the current buffer. + {buffer} Buffer handle, or 0 for current buffer + + See also: ~ + |nvim_set_keymap()| nvim_buf_del_keymap({buffer}, {mode}, {lhs}) *nvim_buf_del_keymap()* - Like |nvim_del_keymap|, but for a specific buffer. + Unmaps a buffer-local |mapping| for the given mode. Parameters: ~ - {buffer} Buffer handle, or 0 for the current buffer. + {buffer} Buffer handle, or 0 for current buffer + + See also: ~ + |nvim_del_keymap()| nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()* Gets a map of buffer-local |user-commands|. |