diff options
author | Nimit Bhardwaj <nimitbhardwaj@gmail.com> | 2018-02-24 15:44:51 +0530 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-05-11 13:20:19 +0200 |
commit | 25b630484023716977c3fe2790c13b41f9db9f30 (patch) | |
tree | c6cd3a539518418da64faab85754220b37ecd3c6 /src/nvim/api/buffer.c | |
parent | 273d2cd5d5cfc7616c76d3531e9938750abcc05e (diff) | |
download | rneovim-25b630484023716977c3fe2790c13b41f9db9f30.tar.gz rneovim-25b630484023716977c3fe2790c13b41f9db9f30.tar.bz2 rneovim-25b630484023716977c3fe2790c13b41f9db9f30.zip |
API: nvim_get_commands()
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 023f434f9d..c4508a0c81 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -24,6 +24,7 @@ #include "nvim/syntax.h" #include "nvim/window.h" #include "nvim/undo.h" +#include "nvim/ex_docmd.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/buffer.c.generated.h" @@ -478,6 +479,26 @@ ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Error *err) return keymap_array(mode, buf); } +/// Gets a list of dictionaries describing buffer-local commands. +/// The "buffer" key in the returned dictionary reflects the buffer +/// handle where the command is present. +/// +/// @param buffer Buffer handle. +/// @param opts Optional parameters, currently always +/// @param[out] err Error details, if any. +/// +/// @returns Array of dictionaries describing commands. +ArrayOf(Dictionary) nvim_buf_get_commands(Buffer buffer, Dictionary opts, + Error *err) + FUNC_API_SINCE(4) +{ + buf_T *buf = find_buffer_by_handle(buffer, err); + if (!buf) { + return (Array)ARRAY_DICT_INIT; + } + return commands_array(buf); +} + /// Sets a buffer-scoped (b:) variable /// /// @param buffer Buffer handle |