Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/denops_std/function/nvim/mod.ts>nvim_set_keymap

📚 Standard module for denops.vim
Go to Latest
function nvim_set_keymap
import { nvim_set_keymap } from "https://deno.land/x/denops_std@v5.0.1/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:

call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})

is equivalent to:

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: keys are :map-arguments, values are booleans (default false). Accepts all :map-arguments as keys excluding <buffer> but including :noremap and "desc". Unknown key is an error. "desc" can be used to give a description to the mapping. When called from Lua, also accepts a "callback" key that takes a Lua function to call when the mapping is executed. When "expr" is true, "replace_keycodes" (boolean) can be used to replace keycodes in the resulting string (see nvim_replace_termcodes()), and a Lua callback returning nil is equivalent to returning an empty string.

Parameters

denops: Denops
mode: unknown
lhs: unknown
rhs: unknown
opts: unknown

Returns

Promise<unknown>