diff options
author | Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> | 2022-09-21 23:58:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 15:58:57 -0600 |
commit | b4b05f160dbb6b9b945c173b7e910b0e4c1a8b01 (patch) | |
tree | f3cb45b07f67d4644f1bbb0d5584b65aa5e89a0f /runtime/doc/lua.txt | |
parent | 37a71d1f28e5d7fd13f0ede69b4d2558157a9e4b (diff) | |
download | rneovim-b4b05f160dbb6b9b945c173b7e910b0e4c1a8b01.tar.gz rneovim-b4b05f160dbb6b9b945c173b7e910b0e4c1a8b01.tar.bz2 rneovim-b4b05f160dbb6b9b945c173b7e910b0e4c1a8b01.zip |
feat(filetype): expand environment variables in filetype patterns (#20145)
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r-- | runtime/doc/lua.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 4be706f1bf..a6a51c1e36 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2082,7 +2082,10 @@ add({filetypes}) *vim.filetype.add()* Filename patterns can specify an optional priority to resolve cases when a file path matches multiple patterns. Higher priorities are matched first. - When omitted, the priority defaults to 0. + When omitted, the priority defaults to 0. A pattern can contain + environment variables of the form "${SOME_VAR}" that will be automatically + expanded. If the environment variable is not set, the pattern won't be + matched. See $VIMRUNTIME/lua/vim/filetype.lua for more examples. @@ -2112,6 +2115,8 @@ add({filetypes}) *vim.filetype.add()* ['.*/etc/foo/.*'] = 'fooscript', -- Using an optional priority ['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } }, + -- A pattern containing an environment variable + ['${XDG_CONFIG_HOME}/foo/git'] = 'git', ['README.(a+)$'] = function(path, bufnr, ext) if ext == 'md' then return 'markdown' |