feat(runtime)!: remove filetype.vim (#20428)

Made obsolete by now graduated `filetype.lua` (enabled by default).

Note that changes or additions to the filetype detection still need to
be made through a PR to vim/vim as we port the _logic_ as well as tests.
This commit is contained in:
Christian Clason
2022-10-17 08:52:40 +02:00
committed by GitHub
parent 9701c9dc9f
commit 042eb74ff1
12 changed files with 27 additions and 4270 deletions

View File

@@ -175,15 +175,13 @@ This means that the contents of compressed files are not inspected.
*new-filetype*
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. The following explains the legacy Vim mechanism (enabled
if |g:do_legacy_filetype| is set). For Nvim's default mechanism, see
|vim.filetype.add()|.
to add it. The recommended way is to use |vim.filetype.add()| to add it to
Nvim's builtin filetype detection mechanism. If you want to handle the
detection manually, proceed as follows:
A. If you want to overrule all default file type checks.
This works by writing one file for each filetype. The disadvantage is that
there can be many files. The advantage is that you can simply drop this
there can be many files. The advantage is that you can simply drop this
file in the right directory to make it work.
*ftdetect*
1. Create your user runtime directory. You would normally use the first
@@ -273,28 +271,14 @@ D. If your filetype can only be detected by inspecting the contents of the
means that your rules override the default rules in
$VIMRUNTIME/scripts.vim.
*remove-filetype*
If a file type is detected that is wrong for you, install a filetype.lua,
filetype.vim or scripts.vim to catch it (see above). You can set 'filetype' to
a non-existing name to avoid that it will be set later anyway: >
:set filetype=ignored
*remove-filetype*
If a file type is detected that is wrong for you, you can set 'filetype' to
a non-existing name such as `ignored` to avoid that it will be set later anyway.
If you are setting up a system with many users, and you don't want each user
to add/remove the same filetypes, consider writing the filetype.vim and
scripts.vim files in a runtime directory that is used for everybody. Check
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*
*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.
the `did_load_filetypes` global variable. If this variable exists, the default
`$VIMRUNTIME/filetype.lua` will not run.
*plugin-details*
The "plugin" directory can be in any of the directories in the 'runtimepath'

View File

@@ -2045,9 +2045,6 @@ add({filetypes}) *vim.filetype.add()*
See $VIMRUNTIME/lua/vim/filetype.lua for more examples.
Note that Lua filetype detection is disabled when |g:do_legacy_filetype|
is set.
Example: >
vim.filetype.add({
@@ -2084,7 +2081,7 @@ add({filetypes}) *vim.filetype.add()*
})
<
To add a fallback match on contents (see |new-filetype-scripts|), use >
To add a fallback match on contents, use >
vim.filetype.add {
pattern = {

View File

@@ -13,7 +13,7 @@ BREAKING CHANGES *news-breaking*
The following changes may require adaptations in user config or plugins.
Cscope is now removed (see |cscope| and |nvim-features-removed|):
Cscope is now removed (see |cscope| and |nvim-features-removed|):
- Commands removed:
- `:cscope`
- `:lcscope`
@@ -30,9 +30,9 @@ Cscope is now removed (see |cscope| and |nvim-features-removed|):
- Eval functions removed:
- `cscope_connection()`
Note: support for |ctags| remains with no plans to remove.
Note: support for |ctags| remains with no plans to remove.
See https://github.com/neovim/neovim/pull/20545 for more information.
See https://github.com/neovim/neovim/pull/20545 for more information.
==============================================================================
NEW FEATURES *news-features*
@@ -49,6 +49,11 @@ REMOVED FEATURES *news-removed*
The following deprecated functions or APIs were removed.
• `filetype.vim` is removed in favor of |lua-filetype|
(Note that filetype logic and tests still align with Vim, so additions or
changes need to be contributed there first.)
See https://github.com/neovim/neovim/pull/20674.
==============================================================================
DEPRECATIONS *news-deprecations*

View File

@@ -4912,8 +4912,7 @@ A jump table for the options with a short description can be found at |Q_op|.
$XDG_CONFIG_HOME/nvim/after")
global
List of directories to be searched for these runtime files:
filetype.vim filetypes by file name |new-filetype|
scripts.vim filetypes by file contents |new-filetype-scripts|
filetype.lua filetypes |new-filetype|
autoload/ automatically loaded scripts |autoload-functions|
colors/ color scheme files |:colorscheme|
compiler/ compiler files |:compiler|

View File

@@ -458,7 +458,7 @@ accordingly, proceeding as follows:
7. Enable filetype detection.
This does the same as the command: >
:runtime! filetype.lua filetype.vim
:runtime! filetype.lua
< Skipped if ":filetype off" was called or if the "-u NONE" command line
argument was given.