diff options
author | TJ DeVries <timothydvrs1234@gmail.com> | 2017-05-25 05:41:53 -0500 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2017-05-25 12:41:53 +0200 |
commit | 45626de63f2b8057c13df0466406c43f04d6a1e6 (patch) | |
tree | 8d7b632a2be423f21d93d895cafe22e1a3ce60fa /src/nvim/api/buffer.c | |
parent | f4fddbfb778ad5c6600af90d323156e42ee13450 (diff) | |
download | rneovim-45626de63f2b8057c13df0466406c43f04d6a1e6.tar.gz rneovim-45626de63f2b8057c13df0466406c43f04d6a1e6.tar.bz2 rneovim-45626de63f2b8057c13df0466406c43f04d6a1e6.zip |
get_keymap API (#6236)
* Add api function get keymap
nvim_get_keymap(mode)
nvim_buf_get_keymap(buffer, mode)
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 0b8d39d0d2..fc11708bd6 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -453,6 +453,26 @@ Integer nvim_buf_get_changedtick(Buffer buffer, Error *err) return buf->b_changedtick; } +/// Get a list of dictionaries describing buffer-local mappings +/// Note that the buffer key in the dictionary will represent the buffer +/// handle where the mapping is present +/// +/// @param mode The abbreviation for the mode +/// @param buffer_id Buffer handle +/// @param[out] err Error details, if any +/// @returns An array of maparg() like dictionaries describing mappings +ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Error *err) + FUNC_API_SINCE(3) +{ + buf_T *buf = find_buffer_by_handle(buffer, err); + + if (!buf) { + return (Array)ARRAY_DICT_INIT; + } + + return keymap_array(mode, buf); +} + /// Sets a buffer-scoped (b:) variable /// /// @param buffer Buffer handle |