diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2023-03-20 10:30:59 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-20 10:30:59 +0000 |
| commit | d8f9dcd5deb72f1fbc706d7b3bb5b823c7998e38 (patch) | |
| tree | 9354e0f324c274ba9aaae31ddb2269b1a6a54268 /runtime/lua/vim/filetype.lua | |
| parent | 84027f7515b8ee6f818462f105882fc0052783c4 (diff) | |
| parent | e5641df6d3fc3bb6c3c55593b6152082bfc561b6 (diff) | |
| download | rneovim-d8f9dcd5deb72f1fbc706d7b3bb5b823c7998e38.tar.gz rneovim-d8f9dcd5deb72f1fbc706d7b3bb5b823c7998e38.tar.bz2 rneovim-d8f9dcd5deb72f1fbc706d7b3bb5b823c7998e38.zip | |
Merge pull request #22634 from lewis6991/feat/tscomment
feat: add vim.filetype.get_option()
Diffstat (limited to 'runtime/lua/vim/filetype.lua')
| -rw-r--r-- | runtime/lua/vim/filetype.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index cf813b19b1..69fcb01e8c 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2631,4 +2631,24 @@ function M.match(args) end end +--- Get the default option value for a {filetype}. +--- +--- The returned value is what would be set in a new buffer after 'filetype' +--- is set, meaning it should respect all FileType autocmds and ftplugin files. +--- +--- Example: +--- <pre>lua +--- vim.filetype.get_option('vim', 'commentstring') +--- </pre> +--- +--- Note: this uses |nvim_get_option_value()| but caches the result. +--- This means |ftplugin| and |FileType| autocommands are only +--- triggered once and may not reflect later changes. +--- @param filetype string Filetype +--- @param option string Option name +--- @return string|boolean|integer: Option value +function M.get_option(filetype, option) + return require('vim.filetype.options').get_option(filetype, option) +end + return M |