diff options
-rw-r--r-- | runtime/doc/lua.txt | 6 | ||||
-rw-r--r-- | runtime/lua/vim/_editor.lua | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c2f5941a5c..6a1d94d34b 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1622,9 +1622,9 @@ vim.on_key({fn}, {ns_id}) *vim.on_key()* • {fn} will receive the keys after mappings have been evaluated Parameters: ~ - • {fn} (`fun(key: string)`) Function invoked on every key press. - |i_CTRL-V| Returning nil removes the callback associated with - namespace {ns_id}. + • {fn} (`fun(key: string)?`) Function invoked on every key press. + |i_CTRL-V| Passing in nil when {ns_id} is specified removes + the callback associated with namespace {ns_id}. • {ns_id} (`integer?`) Namespace ID. If nil or 0, generates and returns a new |nvim_create_namespace()| id. diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index c130eb1958..c5a6e65e86 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -652,8 +652,9 @@ local on_key_cbs = {} ---@note {fn} will not be cleared by |nvim_buf_clear_namespace()| ---@note {fn} will receive the keys after mappings have been evaluated --- ----@param fn fun(key: string) Function invoked on every key press. |i_CTRL-V| ---- Returning nil removes the callback associated with namespace {ns_id}. +---@param fn fun(key: string)? Function invoked on every key press. |i_CTRL-V| +--- Passing in nil when {ns_id} is specified removes the +--- callback associated with namespace {ns_id}. ---@param ns_id integer? Namespace ID. If nil or 0, generates and returns a --- new |nvim_create_namespace()| id. --- |