import { nvim_set_keymap } from "https://deno.land/x/denops_std@v6.5.0/function/nvim/mod.ts";
Sets a global mapping
for the given mode.
To set a buffer-local mapping, use nvim_buf_set_keymap()
.
Unlike :map
, leading/trailing whitespace is accepted as part of the
{lhs} or {rhs}. Empty {rhs} is <Nop>
. keycodes
are replaced as usual.
Example: >vim call nvim_set_keymap('n', ' ', '', {'nowait': v:true}) <
is equivalent to: >vim
nmap <nowait>
<Space><NL>
<Nop>
<
Parameters:
- {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} Optional parameters map: Accepts all
:map-arguments
as keys except<buffer>
, values are booleans (default false). Also: - "noremap" non-recursive mapping:noremap
- "desc" human-readable description. - "callback" Lua function called when the mapping is executed. - "replace_keycodes" (boolean) When "expr" is true, replace keycodes in the resulting string (seenvim_replace_termcodes()
). Returning nil from the Lua "callback" is equivalent to returning an empty string.