diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-12-31 20:10:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-31 20:10:35 +0100 |
commit | b218d02c442ebacba1fdef0cca9e40315a46aedd (patch) | |
tree | 0780d3d7eed40aff1e94347922dc7d5b0ca23107 /src/nvim/api/vim.c | |
parent | 5c1b8b77c59d06f80368784f0eac92d6a331a313 (diff) | |
parent | b411f436d3e2e8a902dbf879d00fc5ed0fc436d3 (diff) | |
download | rneovim-b218d02c442ebacba1fdef0cca9e40315a46aedd.tar.gz rneovim-b218d02c442ebacba1fdef0cca9e40315a46aedd.tar.bz2 rneovim-b218d02c442ebacba1fdef0cca9e40315a46aedd.zip |
Merge pull request #16594 from shadmansaleh/feat/api/lua_keymaps
feat(api): add support for lua function & description in keymap
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index dfc606f927..693d2083e6 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1538,10 +1538,10 @@ Dictionary nvim_get_mode(void) /// @param mode Mode short-name ("n", "i", "v", ...) /// @returns Array of maparg()-like dictionaries describing mappings. /// The "buffer" key is always zero. -ArrayOf(Dictionary) nvim_get_keymap(String mode) +ArrayOf(Dictionary) nvim_get_keymap(uint64_t channel_id, String mode) FUNC_API_SINCE(3) { - return keymap_array(mode, NULL); + return keymap_array(mode, NULL, channel_id == LUA_INTERNAL_CALL); } /// Sets a global |mapping| for the given mode. @@ -1566,7 +1566,10 @@ ArrayOf(Dictionary) nvim_get_keymap(String mode) /// @param lhs Left-hand-side |{lhs}| of the mapping. /// @param rhs Right-hand-side |{rhs}| of the mapping. /// @param opts Optional parameters map. Accepts all |:map-arguments| -/// as keys excluding |<buffer>| but including |noremap|. +/// as keys excluding |<buffer>| but including |noremap| and "desc". +/// |desc| can be used to give a description to keymap. +/// When called from Lua, also accepts a "callback" key that takes +/// a Lua function to call when the mapping is executed. /// Values are Booleans. Unknown key is an error. /// @param[out] err Error details, if any. void nvim_set_keymap(String mode, String lhs, String rhs, Dict(keymap) *opts, Error *err) |