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/doc | |
| 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/doc')
| -rw-r--r-- | runtime/doc/api.txt | 4 | ||||
| -rw-r--r-- | runtime/doc/lua.txt | 22 | ||||
| -rw-r--r-- | runtime/doc/news.txt | 6 |
3 files changed, 32 insertions, 0 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index b8590026c8..289788f036 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1969,6 +1969,10 @@ nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()* • win: |window-ID|. Used for getting window local options. • buf: Buffer number. Used for getting buffer local options. 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 will trigger |ftplugin| and all |FileType| + autocommands for the corresponding filetype. Return: ~ Option value diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 611f2e0d32..e7dcc79f4a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2206,6 +2206,28 @@ add({filetypes}) *vim.filetype.add()* • {filetypes} (table) A table containing new filetype maps (see example). +get_option({filetype}, {option}) *vim.filetype.get_option()* + 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: >lua + vim.filetype.get_option('vim', 'commentstring') +< + + 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. + + Parameters: ~ + • {filetype} string Filetype + • {option} string Option name + + Return: ~ + string|boolean|integer: Option value + match({args}) *vim.filetype.match()* Perform filetype detection. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 64cf5d78ba..5ac6db6f84 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -210,6 +210,12 @@ The following new APIs or features were added. https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection . Support for the previous format will be removed in a future release. +• |nvim_get_option_value()| now has a `filetype` option so it can return the + default option for a specific filetype. + +• |vim.filetype.get_option()| to get the default option value for a specific + filetype. This is a wrapper around |nvim_get_option_value()| with caching. + ============================================================================== CHANGED FEATURES *news-changes* |