aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/filetype.txt
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-07-07 18:53:47 +0200
committerGitHub <noreply@github.com>2022-07-07 18:53:47 +0200
commit72877bb17d70362f91a60b31bf0244dbf8ed58ae (patch)
tree88076380195582a7c8e4a886691c77bd52aa4e1d /runtime/doc/filetype.txt
parent0950275b8c8dff37cf08aae0680a248f8e963497 (diff)
downloadrneovim-72877bb17d70362f91a60b31bf0244dbf8ed58ae.tar.gz
rneovim-72877bb17d70362f91a60b31bf0244dbf8ed58ae.tar.bz2
rneovim-72877bb17d70362f91a60b31bf0244dbf8ed58ae.zip
feat(runtime)!: enable filetype.lua by default (#19216)
* revert to filetype.vim by setting `g:do_legacy_filetype` * skip either filetype.lua or filetype.vim via `g:did_load_filetypes` (Running both is no longer required and therefore no longer supported.)
Diffstat (limited to 'runtime/doc/filetype.txt')
-rw-r--r--runtime/doc/filetype.txt47
1 files changed, 14 insertions, 33 deletions
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 7f88216f43..7fff74a963 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -177,7 +177,9 @@ This means that the contents of compressed files are not inspected.
If a file type that you want to use is not detected yet, there are a few ways
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.lua
or $VIMRUNTIME/filetype.vim files. They will be overwritten when installing a
-new version of Nvim.
+new version of Nvim. The following explains the legacy Vim mechanism (enabled
+if |do_legacy_filetype| is set). For Nvim's default mechanism, see
+|vim.filetype.add()|.
A. If you want to overrule all default file type checks.
This works by writing one file for each filetype. The disadvantage is that
@@ -236,39 +238,8 @@ C. If your file type can be detected by the file name or extension.
Write this file as "filetype.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.config/nvim/filetype.vim
-<
- Alternatively, create a file called "filetype.lua" that adds new
- filetypes.
- Example: >
- vim.filetype.add({
- extension = {
- foo = "fooscript",
- },
- filename = {
- [".foorc"] = "foorc",
- },
- pattern = {
- [".*/etc/foo/.*%.conf"] = "foorc",
- },
- })
-<
- See |vim.filetype.add()|.
- *g:do_filetype_lua*
- For now, Lua filetype detection is opt-in. You can enable it by adding
- the following to your |init.vim|: >
- let g:do_filetype_lua = 1
-< *g:did_load_filetypes*
- In either case, the builtin filetype detection provided by Nvim can be
- disabled by setting the did_load_filetypes global variable. If this
- variable exists, $VIMRUNTIME/filetype.vim will not run.
- Example: >
- " Disable filetype.vim (but still load filetype.lua if enabled)
- let g:did_load_filetypes = 0
- " Disable filetype.vim and filetype.lua
- let g:did_load_filetypes = 1
-
-< 3. To use the new filetype detection you must restart Vim.
+< 3. To use the new filetype detection you must restart Vim.
Your filetype.vim will be sourced before the default FileType autocommands
have been installed. Your autocommands will match first, and the
@@ -315,6 +286,16 @@ the 'runtimepath' for a directory to use. If there isn't one, set
'runtimepath' in the |system-vimrc|. Be careful to keep the default
directories!
+ *g:do_legacy_filetype*
+To disable Nvim's default filetype detection and revert to Vim's legacy
+filetype detection, add the following to your |init.vim|: >
+ let g:do_legacy_filetype = 1
+< *g:did_load_filetypes*
+The builtin filetype detection provided by Nvim can be disabled by setting
+the `did_load_filetypes` global variable. If this variable exists, neither
+the default `$VIMRUNTIME/filetype.lua` nor the legacy `$VIMRUNTIME/filetype.vim`
+will run.
+
*plugin-details*
The "plugin" directory can be in any of the directories in the 'runtimepath'
option. All of these directories will be searched for plugins and they are