diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-04-01 09:09:30 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2022-04-01 09:09:30 +0100 |
commit | 3cc29b7f0d6e1661f39d28716c6a63603a93c11c (patch) | |
tree | 0be0e445e5a17ab2009be67995e228218d47554d | |
parent | dc3bbd31a9d6c36944b7f26127d9d46b21a70c2f (diff) | |
download | rneovim-3cc29b7f0d6e1661f39d28716c6a63603a93c11c.tar.gz rneovim-3cc29b7f0d6e1661f39d28716c6a63603a93c11c.tar.bz2 rneovim-3cc29b7f0d6e1661f39d28716c6a63603a93c11c.zip |
fix(keymap): don't coerce false to ''
-rw-r--r-- | runtime/doc/lua.txt | 2 | ||||
-rw-r--r-- | runtime/lua/vim/keymap.lua | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index d13e883c28..25c5dd326e 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2025,7 +2025,7 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* {rhs} string|function Right-hand side |{rhs}| of the mapping. Can also be a Lua function. If a Lua function and `opts.expr == true`, returning `nil` - or `false` is equivalent to an empty string. + is equivalent to an empty string. {opts} table A table of |:map-arguments| such as "silent". In addition to the options listed in |nvim_set_keymap()|, this table also accepts the diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index c193a13a7b..0986d21196 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -35,8 +35,8 @@ local keymap = {} --- Can also be list of modes to create mapping on multiple modes. ---@param lhs string Left-hand side |{lhs}| of the mapping. ---@param rhs string|function Right-hand side |{rhs}| of the mapping. Can also be a Lua function. ---- If a Lua function and `opts.expr == true`, returning `nil` or `false` ---- is equivalent to an empty string. +--- If a Lua function and `opts.expr == true`, returning `nil` is +--- equivalent to an empty string. -- ---@param opts table A table of |:map-arguments| such as "silent". In addition to the options --- listed in |nvim_set_keymap()|, this table also accepts the following keys: @@ -62,7 +62,7 @@ function keymap.set(mode, lhs, rhs, opts) local user_rhs = rhs rhs = function () local res = user_rhs() - if not res then + if res == nil then -- TODO(lewis6991): Handle this in C? return '' elseif opts.replace_keycodes ~= false then |