aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-12-31 20:10:35 +0100
committerGitHub <noreply@github.com>2021-12-31 20:10:35 +0100
commitb218d02c442ebacba1fdef0cca9e40315a46aedd (patch)
tree0780d3d7eed40aff1e94347922dc7d5b0ca23107 /src/nvim/eval.c
parent5c1b8b77c59d06f80368784f0eac92d6a331a313 (diff)
parentb411f436d3e2e8a902dbf879d00fc5ed0fc436d3 (diff)
downloadrneovim-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/eval.c')
-rw-r--r--src/nvim/eval.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 86384bc5b2..6dbdc09c3b 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -7299,12 +7299,19 @@ void mapblock_fill_dict(dict_T *const dict, const mapblock_T *const mp, long buf
noremap_value = mp->m_noremap == REMAP_SCRIPT ? 2 : !!mp->m_noremap;
}
- if (compatible) {
- tv_dict_add_str(dict, S_LEN("rhs"), (const char *)mp->m_orig_str);
+ if (mp->m_luaref != LUA_NOREF) {
+ tv_dict_add_nr(dict, S_LEN("callback"), mp->m_luaref);
} else {
- tv_dict_add_allocated_str(dict, S_LEN("rhs"),
- str2special_save((const char *)mp->m_str, false,
- true));
+ if (compatible) {
+ tv_dict_add_str(dict, S_LEN("rhs"), (const char *)mp->m_orig_str);
+ } else {
+ tv_dict_add_allocated_str(dict, S_LEN("rhs"),
+ str2special_save((const char *)mp->m_str, false,
+ true));
+ }
+ }
+ if (mp->m_desc != NULL) {
+ tv_dict_add_allocated_str(dict, S_LEN("desc"), xstrdup(mp->m_desc));
}
tv_dict_add_allocated_str(dict, S_LEN("lhs"), lhs);
tv_dict_add_nr(dict, S_LEN("noremap"), noremap_value);