diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-03-11 17:11:02 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-03-20 10:06:32 +0000 |
commit | e5641df6d3fc3bb6c3c55593b6152082bfc561b6 (patch) | |
tree | 9354e0f324c274ba9aaae31ddb2269b1a6a54268 /src/nvim/api/options.c | |
parent | e1db0e35e4d5859b96e6aff882df62d6c714b569 (diff) | |
download | rneovim-e5641df6d3fc3bb6c3c55593b6152082bfc561b6.tar.gz rneovim-e5641df6d3fc3bb6c3c55593b6152082bfc561b6.tar.bz2 rneovim-e5641df6d3fc3bb6c3c55593b6152082bfc561b6.zip |
feat: add `vim.filetype.get_option()`
Diffstat (limited to 'src/nvim/api/options.c')
-rw-r--r-- | src/nvim/api/options.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c index a0351cc6cd..7aef6e6146 100644 --- a/src/nvim/api/options.c +++ b/src/nvim/api/options.c @@ -114,7 +114,11 @@ static buf_T *do_ft_buf(char *filetype, aco_save_T *aco, Error *err) ftbuf->b_p_ft = xstrdup(filetype); - apply_autocmds(EVENT_FILETYPE, ftbuf->b_p_ft, ftbuf->b_fname, true, ftbuf); + TRY_WRAP({ + try_start(); + apply_autocmds(EVENT_FILETYPE, ftbuf->b_p_ft, ftbuf->b_fname, true, ftbuf); + try_end(err); + }); return ftbuf; } @@ -133,8 +137,8 @@ static buf_T *do_ft_buf(char *filetype, aco_save_T *aco, Error *err) /// Implies {scope} is "local". /// - filetype: |filetype|. Used to get the default option for a /// specific filetype. Cannot be used with any other option. -/// Note: this is expensive, it is recommended to cache this -/// value. +/// Note: this will trigger |ftplugin| and all |FileType| +/// autocommands for the corresponding filetype. /// @param[out] err Error details, if any /// @return Option value Object nvim_get_option_value(String name, Dict(option) *opts, Error *err) |