aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-04 13:45:32 +0100
committerGitHub <noreply@github.com>2020-12-04 13:45:32 +0100
commit6c344a75d4d312ca1b514b37d3a37bb2ebc07388 (patch)
treee7c045a88c37ac60ba2148a351a1816cb7216b87 /src/nvim/api/vim.c
parent44be2dfca192db9f47d59c6bb29975c9730c5827 (diff)
parent17a58043a3fc49179a47590e905ed3a7d5a29907 (diff)
downloadrneovim-6c344a75d4d312ca1b514b37d3a37bb2ebc07388.tar.gz
rneovim-6c344a75d4d312ca1b514b37d3a37bb2ebc07388.tar.bz2
rneovim-6c344a75d4d312ca1b514b37d3a37bb2ebc07388.zip
Merge pull request #13173 from tjdevries/tjdevries/option_info
api: add option metadata
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 77002697fe..8ac820abd9 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -970,6 +970,47 @@ Object nvim_get_option(String name, Error *err)
return get_option_from(NULL, SREQ_GLOBAL, name, err);
}
+/// Gets the option information for all options.
+///
+/// The dictionary has the full option names as keys and option metadata
+/// dictionaries as detailed at |nvim_get_option_info|.
+///
+/// @return dictionary of all options
+Dictionary nvim_get_all_options_info(Error *err)
+ FUNC_API_SINCE(7)
+{
+ return get_all_vimoptions();
+}
+
+/// Gets the option information for one option
+///
+/// Resulting dictionary has keys:
+/// - name: Name of the option (like 'filetype')
+/// - shortname: Shortened name of the option (like 'ft')
+/// - type: type of option ("string", "integer" or "boolean")
+/// - default: The default value for the option
+/// - was_set: Whether the option was set.
+///
+/// - last_set_sid: Last set script id (if any)
+/// - last_set_linenr: line number where option was set
+/// - last_set_chan: Channel where option was set (0 for local)
+///
+/// - scope: one of "global", "win", or "buf"
+/// - global_local: whether win or buf option has a global value
+///
+/// - commalist: List of comma separated values
+/// - flaglist: List of single char flags
+///
+///
+/// @param name Option name
+/// @param[out] err Error details, if any
+/// @return Option Information
+Dictionary nvim_get_option_info(String name, Error *err)
+ FUNC_API_SINCE(7)
+{
+ return get_vimoption(name, err);
+}
+
/// Sets an option value.
///
/// @param channel_id