Filetype
Nvim:help pages,generated fromsource using thetree-sitter-vimdoc parser.
Vim can detect the type of file that is edited. This is done by checking thefile name and sometimes by inspecting the contents of the file for specifictext.
:filetype:filetTo enable file type detection, use this command in your vimrc:
:filetype on
Each time a new or existing file is edited, Vim will try to recognize the typeof the file and set the
'filetype' option. This will trigger the FileTypeevent, which can be used to set the syntax highlighting, set options, etc.
Detail: The ":filetype on" command will load these files:$VIMRUNTIME/filetype.lua$VIMRUNTIME/filetype.vimfiletype.lua creates an autocommand that fires for all BufNewFile andBufRead events. It tries to detect the filetype based off of thefile's extension or name.
filetype.vim is a Vim script that defines autocommands for theBufNewFile and BufRead events. In contrast to filetype.lua, thisfile creates separate BufNewFile and BufRead events for each filetypepattern.
If the file type is not found by the name, the file$VIMRUNTIME/scripts.vim is used to detect it from the contents of thefile.When the GUI is running or will start soon, the
menu.vim script isalso sourced.
To add your own file types, see
new-filetype below. To search for help on afiletype prepend "ft-" and optionally append "-syntax", "-indent" or"-plugin". For example:
:help ft-vim-indent:help ft-vim-syntax:help ft-man-plugin
If the file type is not detected automatically, or it finds the wrong type,you can either set the
'filetype' option manually, or add a modeline to yourfile. Example, for an IDL file use the command:
:set filetype=idl
or add this
modeline to the file:
/* vim: set filetype=idl : */
:filetype-plugin-onYou can enable loading the plugin files for specific file types with:
:filetype plugin on
If filetype detection was not switched on yet, it will be as well.This actually loads the file "ftplugin.vim" in
'runtimepath'.The result is that when a file is edited its plugin file is loaded (if thereis one for the detected filetype).
filetype-plugin :filetype-plugin-offYou can disable it again with:
:filetype plugin off
The filetype detection is not switched off then. But if you do switch offfiletype detection, the plugins will not be loaded either.This actually loads the file "ftplugof.vim" in
'runtimepath'.
:filetype-indent-onYou can enable loading the indent file for specific file types with:
:filetype indent on
If filetype detection was not switched on yet, it will be as well.This actually loads the file "indent.vim" in
'runtimepath'.The result is that when a file is edited its indent file is loaded (if thereis one for the detected filetype).
indent-expression :filetype-indent-offYou can disable it again with:
:filetype indent off
The filetype detection is not switched off then. But if you do switch offfiletype detection, the indent files will not be loaded either.This actually loads the file "indoff.vim" in
'runtimepath'.This disables auto-indenting for files you will open. It will keep working inalready opened files. Reset
'autoindent',
'cindent',
'smartindent' and/or
'indentexpr' to disable indenting in an opened file.
:filetype-offTo disable file type detection, use this command:
:filetype off
This will keep the flags for "plugin" and "indent", but since no file typesare being detected, they won't work until the next ":filetype on".
commanddetectionpluginindent
:filetype ononunchangedunchanged:filetype offoffunchangedunchanged:filetype plugin onononunchanged:filetype plugin offunchangedoffunchanged:filetype indent ononunchangedon:filetype indent offunchangedunchangedoff:filetype plugin indent onononon:filetype plugin indent offunchangedoffoff
To see the current status, type:
:filetype
The output looks something like this:
filetype detection:ON plugin:ON indent:OFF
The file types are also used for syntax highlighting. If the ":syntax on"command is used, the file type detection is installed too. There is no needto do ":filetype on" after ":syntax on".
To disable one of the file types, add a line in your filetype file, see
remove-filetype.
filetype-detectTo detect the file type again:
:filetype detect
Use this if you started with an empty file and typed text that makes itpossible to detect the file type. For example, when you entered this in ashell script: "#!/bin/csh". When filetype detection was off, it will be enabled first, like the "on"argument was used.
filetype-overruleWhen the same extension is used for multiple filetypes, Vim tries to guesswhat kind of file it is. This doesn't always work. A number of globalvariables can be used to overrule the filetype used for certain extensions:
For a few filetypes the global variable is used only when the filetype couldnot be detected:
*.r g:filetype_r
ft-rexx-syntaxfiletype-ignoreTo avoid that certain files are being inspected, the g:ft_ignore_pat variableis used. The default value is set like this:
:let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
This means that the contents of compressed files are not inspected.
new-filetypeIf a file type that you want to use is not detected yet, there are a few waysto add it. The recommended way is to use
vim.filetype.add() to add it toNvim's builtin filetype detection mechanism. If you want to handle thedetection 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 file in the right directory to make it work.
ftdetect 1. Create your user runtime directory. You would normally use the first item of the
'runtimepath' option. Then create the directory "ftdetect" inside it. Example for Unix:
:!mkdir -p ~/.config/nvim/ftdetect
2. Create a file that contains an autocommand to detect the file type. Example:
au BufRead,BufNewFile *.mineset filetype=mine
Note that there is no "augroup" command, this has already been done when sourcing your file. You could also use the pattern "*" and then check the contents of the file to recognize it. Write this file as "mine.vim" in the "ftdetect" directory in your user runtime directory. For example, for Unix:
:w ~/.config/nvim/ftdetect/mine.vim
3. To use the new filetype detection you must restart Vim.
The files in the "ftdetect" directory are used after all the default checks, thus they can overrule a previously detected file type. But you can also use
:setfiletype to keep a previously detected filetype.
B. If you want to detect your file after the default file type checks.
This works like A above, but instead of setting
'filetype' unconditionally use ":setfiletype". This will only set
'filetype' if no file type was detected yet. Example:
au BufRead,BufNewFile *.txtsetfiletype text
You can also use the already detected file type in your command. For example, to use the file type "mypascal" when "pascal" has been detected:
au BufRead,BufNewFile *if &ft == 'pascal' | set ft=mypascal | endif
C. If your file type can be detected by the file name or extension. 1. Create your user runtime directory. You would normally use the first item of the
'runtimepath' option. Example for Unix:
:!mkdir -p ~/.config/nvim
2. Create a file that contains autocommands to detect the file type. Example:
" my filetype fileif exists("did_load_filetypes") finishendifaugroup filetypedetect au! BufRead,BufNewFile *.minesetfiletype mine au! BufRead,BufNewFile *.xyzsetfiletype drawingaugroup END Write this file as "filetype.vim" in your user runtime directory. For example, for Unix:
:w ~/.config/nvim/filetype.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 ":setfiletype" command will make sure that no other autocommands will set
'filetype' after this.
new-filetype-scriptsD. If your filetype can only be detected by inspecting the contents of the file.
1. Create your user runtime directory. You would normally use the first item of the
'runtimepath' option. Example for Unix:
:!mkdir -p ~/.config/nvim
2. Create a Vim script file for doing this. Example:
if did_filetype()" filetype already set.. finish" ..don't do these checksendifif getline(1) =~ '^#!.*\<mine\>' setfiletype mineelseif getline(1) =~? '\<drawing\>' setfiletype drawingendif
See $VIMRUNTIME/scripts.vim for more examples. Write this file as "scripts.vim" in your user runtime directory. For example, for Unix:
:w ~/.config/nvim/scripts.vim
3. The detection will work right away, no need to restart Vim.
Your scripts.vim is loaded before the default checks for file types, which means that your rules override the default rules in $VIMRUNTIME/scripts.vim.
remove-filetypeIf a file type is detected that is wrong for you, you can set
'filetype' toa non-existing name such as
ignored to avoid that it will be set later anyway.
g:did_load_filetypesThe builtin filetype detection provided by Nvim can be disabled by settingthe
did_load_filetypes global variable. If this variable exists, the default
$VIMRUNTIME/filetype.lua will not run.
plugin-detailsThe "plugin" directory can be in any of the directories in the
'runtimepath'option. All of these directories will be searched for plugins and they areall loaded. For example, if this command:
set runtimepath
produces this output:
runtimepath=/etc/vim,~/.config/nvim,/usr/local/share/vim/vim82
then Vim will load all plugins in these directories and below:
/etc/vim/plugin/
~/.config/nvim/plugin/
/usr/local/share/vim/vim82/plugin/
Note that the last one is the value of $VIMRUNTIME which has been expanded.
Note that when using a plugin manager or
packages many directories will beadded to
'runtimepath'. These plugins each require their own directory, don'tput them directly in ~/.config/nvim/plugin.
What if it looks like your plugin is not being loaded? You can find out whathappens when Vim starts up by using the
-V argument:
vim -V2
You will see a lot of messages, in between them is a remark about loading theplugins. It starts with:
Searching for "plugin/**/*.vim" in
There you can see where Vim looks for your plugin scripts.
When loading filetype plugins has been enabled
:filetype-plugin-on, optionswill be set and mappings defined. These are all local to the buffer, theywill not be used for other files.
Defining mappings for a filetype may get in the way of the mappings youdefine yourself. There are a few ways to avoid this:1. Set the "maplocalleader" variable to the key sequence you want the mappings to start with. Example:
:let maplocalleader = ","
All mappings will then start with a comma instead of the default, which is a backslash. Also see
<LocalLeader>.
2. Define your own mapping. Example:
:map ,p <Plug>MailQuote
You need to check the description of the plugin file below for the functionality it offers and the string to map to. You need to define your own mapping before the plugin is loaded (before editing a file of that type). The plugin will then skip installing the default mapping.
no_mail_mapsg:no_mail_maps3. Disable defining mappings for a specific filetype by setting a variable, which contains the name of the filetype. For the "mail" filetype this would be:
:let no_mail_maps = 1
ftplugin-overruleIf a global filetype plugin does not do exactly what you want, there are threeways to change this:
1. Add a few settings. You must create a new filetype plugin in a directory early in
'runtimepath'. For Unix, for example you could use this file:
vim ~/.config/nvim/ftplugin/fortran.vim
You can set those settings and mappings that you would like to add. Note that the global plugin will be loaded after this, it may overrule the settings that you do here. If this is the case, you need to use one of the following two methods.
2. Make a copy of the plugin and change it. You must put the copy in a directory early in
'runtimepath'. For Unix, for example, you could do this:
cp $VIMRUNTIME/ftplugin/fortran.vim ~/.config/nvim/ftplugin/fortran.vim
Then you can edit the copied file to your liking. Since the b:did_ftplugin variable will be set, the global plugin will not be loaded. A disadvantage of this method is that when the distributed plugin gets improved, you will have to copy and modify it again.
3. Overrule the settings after loading the global plugin. You must create a new filetype plugin in a directory from the end of
'runtimepath'. For Unix, for example, you could use this file:
vim ~/.config/nvim/after/ftplugin/fortran.vim
In this file you can change just those settings that you want to change.
plugin_execg:plugin_execEnable executing of external commands. This was done historically for e.g.the perl filetype plugin (and a few others) to set the search path.Disabled by default for security reasons:
:let g:plugin_exec = 1
It is also possible to enable this only for certain filetypes:
:let g:<filetype>_exec = 1
So to enable this only for ruby, set the following variable:
:let g:ruby_exec = 1
If both, the global
plugin_exec and the
<filetype>_exec specific variableare set, the filetype specific variable should have precedent.
To enable
folding use this:
let g:asciidoc_folding = 1
To disable nesting of folded headers use this:
let g:asciidoc_foldnested = 0
To disable folding everything under the title use this:
let asciidoc_fold_under_title = 0
By default the following options are set, in accordance with the defaultsettings of Arduino IDE:
setlocal expandtab tabstop=2 softtabstop=2 shiftwidth=2
To disable this behavior, set the following variable in your vimrc:
let g:arduino_recommended_style = 0
Support for features specific to GNU Awk, like @include, can be enabled bysetting:
:let g:awk_is_gawk = 1
Allows for easy entrance of Changelog entries in Changelog files. There aresome commands, mappings, and variables worth exploring:
Commands:NewChangelogEntryAdds a new Changelog entry in an intelligent fashion(see below).
Local mappings:<Leader>oStarts a new Changelog entry in an equally intelligentfashion (see below).
Global mappings:
NOTE: The global mappings are accessed by sourcing theftplugin/changelog.vim file first, e.g. with
runtime ftplugin/changelog.vim
in your
init.vim.
<Leader>oSwitches to the ChangeLog buffer opened for thecurrent directory, or opens it in a new buffer if itexists in the current directory. Then it does thesame as the local
<Leader>o described above.
Variables:g:changelog_timeformat
Deprecated; use g:changelog_dateformat instead.g:changelog_dateformatThe date (and time) format used in ChangeLog entries.The format accepted is the same as for the
strftime() function.The default is "%Y-%m-%d" which is the standard formatfor many ChangeLog layouts.g:changelog_usernameThe name and email address of the user.The default is deduced from environment variables andsystem files. It searches /etc/passwd for the commentpart of the current user, which informally containsthe real name of the user up to the first separatingcomma. then it checks the $NAME environment variableand finally runs
whoami and
hostname to build anemail address. The final form is
Full Name <user@host>
g:changelog_new_date_formatThe format to use when creating a new date-entry.The following table describes special tokens in thestring:%%insert a single '%' character%dinsert the date from above%uinsert the user from above%pinsert result ofb:changelog_entry_prefix%cwhere to position cursor when doneThe default is "%d %u\n\n\t* %p%c\n\n", whichproduces something like (| is where cursor will be,unless at the start of the line where it denotes thebeginning of the line)
|2003-01-14 Full Name <user@host>|| * prefix|
g:changelog_new_entry_formatThe format used when creating a new entry.The following table describes special tokens in thestring:%pinsert result ofb:changelog_entry_prefix%cwhere to position cursor when doneThe default is "\t*%c", which produces somethingsimilar to
| * prefix|
g:changelog_date_entry_searchThe search pattern to use when searching for adate-entry.The same tokens that can be used forg:changelog_new_date_format can be used here as well.The default is '^\s*%d\_s*%u' which finds linesmatching the form
|2003-01-14 Full Name <user@host>
and some similar formats.
g:changelog_date_end_entry_searchThe search pattern to use when searching for the endof a date-entry.The same tokens that can be used forg:changelog_new_date_format can be used here as well.The default is '^\s*$' which finds lines that containonly whitespace or are completely empty.
b:changelog_name
b:changelog_nameName of the ChangeLog file to look for.The default is 'ChangeLog'.
b:changelog_pathPath of the ChangeLog to use for the current buffer.The default is empty, thus looking for a file named
b:changelog_name in the same directory as thecurrent buffer. If not found, the parent directory ofthe current buffer is searched. This continuesrecursively until a file is found or there are no moreparent directories to search.
b:changelog_entry_prefixName of a function to call to generate a prefix to anew entry. This function takes no arguments andshould return a string containing the prefix.Returning an empty prefix is fine.The default generates the shortest path between theChangeLog's pathname and the current buffers pathname.In the future, it will also be possible to use othervariable contexts for this variable, for example, g:.
The Changelog entries are inserted where they add the least amount of text.After figuring out the current date and user, the file is searched for anentry beginning with the current date and user and if found adds another itemunder it. If not found, a new entry and item is prepended to the beginning ofthe Changelog.
Options:
'expandtab'is switched on to avoid tabs as required by the Fortranstandards unless the user has set fortran_have_tabs in vimrc.
'textwidth'is set to 80 for fixed source format whereas it is set to 132for free source format. Setting thefortran_extended_line_length variable increases the width to132 for fixed source format.
'formatoptions' is set to break code and comment lines and to preserve longlines. You can format comments with
gq.For further discussion of fortran_have_tabs and the method used for thedetection of source format see
ft-fortran-syntax.
This plugin aims to treat the four FreeBASIC dialects, "fb", "qb", "fblite"and "deprecated", as distinct languages.
The dialect will be set to the first name found in g:freebasic_forcelang, any#lang directive or $lang metacommand in the file being edited, or finallyg:freebasic_lang. These global variables conceptually map to the fbc options-forcelang and -lang. If no dialect is explicitly specified "fb" will beused.
For example, to set the dialect to a default of "fblite" but still allow forany #lang directive overrides, use the following command:
let g:freebasic_lang = "fblite"
By default the following options are set, based on Godot official docs:
setlocal noexpandtab softtabstop=0 shiftwidth=0
To disable this behavior, set the following variable in your vimrc:
let g:gdscript_recommended_style = 0
One command, :DiffGitCached, is provided to show a diff of the current commitin the preview window. It is equivalent to calling "git diff --cached" plusany arguments given to the command.
The gitrebase filetype defines the following buffer-local commands, to helpwith interactive
git rebase:
:Drop " to discard this commit:Edit " to stop for editing this commit:Fixup " to squash (but discard the message) into the previous one:Pick " to pick this commit (the cursor is on):Reword " to pick this commit, but change the commit message:Squash " to squash this commit into the previous one
In addition, the following command can be used to cycle between the differentpossibilities:
:Cycle " to cycle between the previous commands
The:Cycle command is also mapped to theCTRL-A andCTRL-X keys.For details, seegit-rebase --help.
By default the following options are set for the recommended gleam style:
setlocal expandtab shiftwidth=2 softtabstop=2
To disable this behavior, set the following variable in your vimrc:
let g:gleam_recommended_style = 0
By default the following options are set, based on Golang official docs:
setlocal noexpandtab softtabstop=0 shiftwidth=0
To disable this behavior, set the following variable in your vimrc:
let g:go_recommended_style = 0
The gprof filetype plugin defines a mapping<C-]> to jump from a functionentry in the gprof flat profile or from a function entry in the call graphto the details of that function in the call graph.
The mapping can be disabled with:
let g:no_gprof_maps = 1
Since the text for this plugin is rather long it has been put in a separatefile:
ft_hare.txt.
Tag folding poses a few difficulties. Many elements, e.g.
blockquote, arealways delimited by start and end tags; end tags for some elements, e.g.
p,can be omitted in certain contexts; void elements, e.g.
hr, have no end tag.Although the rules for supporting omissible end tags are ad-hoc and involved[0], they apply to elements in scope. Assuming syntactical wellformedness, anend tag can be associated with its nearest matching start tag discoverable inscope [1] and towards the beginning of a file, whereas all unbalanced tags andinlined tags can be disregarded. Having syntax highlighting in effect, tagfolding using the
fold-expr method can be enabled with:
let g:html_expr_folding = 1
By default, tag folding will be redone from scratch after each occurrence ofa
TextChanged or an
InsertLeave event. Such frequency may not be desired,especially for large files, and this recomputation can be disabled with:
let g:html_expr_folding_without_recomputation = 1doautocmd FileType
To force another recomputation, do:
unlet! b:foldsmapnormal zx
By default the following options are set:
setlocal shiftwidth=2 tabstop=2 expandtabsetlocal comments=s1:{-,mb:-,ex:-},:\|\|\|,:--setlocal commentstring=--\ %ssetlocal wildignore+=*.ibcTo use tabs instead of spaces for indentation, set the following variablein your vimrc:
let g:idris2#allow_tabchar = 1
Whenever the variable "g:ftplugin_java_source_path" is defined and its valueis a filename whose extension is either ".jar" or ".zip", e.g.:
let g:ftplugin_java_source_path = '/path/to/src.jar'let g:ftplugin_java_source_path = '/path/to/src.zip'
and the
zip plugin has already been sourced, the
gf command can be used toopen the archive and the
n command can be used to look for the selected typeand the
<Return> key can be used to load a listed file.
Note that the effect of using the "gf" command WITHIN a buffer loaded with theZip plugin depends on the version of the Zip plugin. For the Zip pluginversions that do not support Jar type archives, consider creating symboliclinks with the ".zip" extension for each Jar archive of interest and assigningany such file to the variable from now on.
Otherwise, for the defined variable "g:ftplugin_java_source_path", the localvalue of the
'path' option will be further modified by prefixing the value ofthe variable, e.g.:
let g:ftplugin_java_source_path = $JDK_SRC_PATHlet &l:path = g:ftplugin_java_source_path .. ',' .. &l:path
and the "gf" command can be used on a fully-qualified type to look for a filein the "path" and to try to load it.
Remember to manually trigger the
FileType event from a buffer with a Javafile loaded in it each time after assigning a new value to the variable:
doautocmd FileType
Markdown documentation comments may contain common runs of vertical leadingwhitespace following the comment marks (
///) for aesthetic reasons; however,some horizontal runs of leading whitespace are significant in Markdown becausethey denote code blocks etc. For convenience, a
'formatexpr' function isprovided for the
gq operator. As long as neither "g:java_ignore_javadoc"nor "g:java_ignore_markdown" is defined, the reformatting of Markdown commentscan be enabled on demand with:
setlocal formatexpr=g:javaformat#RemoveCommonMarkdownWhitespace()
Or for Vim versions less than
7.4.265, with:
setlocal formatexpr=javaformat#RemoveCommonMarkdownWhitespace()
This function accepts a range of lines, removes a common run of verticalleading whitespace, and rewrites the lines of the range. Depending on theauthor's layout style and the comment contents, which lines to select forreformatting can vary from the whole comment to only some portion of it.To enable the recognition of Markdown comments each time after removing"g:java_ignore_markdown" or "g:java_ignore_javadoc", remember to manuallyre-source "javaformat.vim" for Vim versions greater than
8.2.1397:
runtime autoload/javaformat.vim
For example, to use Lua 5.1, set the variables like this:
let g:lua_version = 5let g:lua_subversion = 1
Options:
'modeline'is switched off to avoid the danger of trojan horses, and toavoid that a Subject line with "Vim:" in it will cause anerror message.
'textwidth'is set to 72. This is often recommended for e-mail.
'formatoptions'is set to break text lines and to repeat the comment leaderin new lines, so that a leading ">" for quotes is repeated.You can also format quoted text with
gq.
Local mappings:<LocalLeader>q or \MailQuoteQuotes the text selected in Visual mode, or from the cursor positionto the end of the file in Normal mode. This means "> " is inserted ineach line.
View manpages in Nvim. Supports highlighting, completion, locales, andnavigation. Also see
find-manpage.
man.lua will always attempt to reuse the closest man window (above/left) butotherwise create a split.
Commands:Man{name} Display the manpage for{name}.Man{sect}{name} Display the manpage for{name} and section{sect}.Man{name}({sect}) Same as above.Man{sect}{name}({sect}) Used during completion to show the real section of when the provided section is a prefix, e.g. 1m vs 1.Man{path} Open the manpage at{path}. Prepend "./" if{path} is relative to the current directory.Man Open the manpage for the<cWORD> (man buffers) or<cword> (non-man buffers) under the cursor.Man! Display the current buffer contents as a manpage.
:Man accepts command modifiers. For example, to use a vertical split:
:vertical Man printf
To reuse the current window:
:hide Man printf
Local mappings:K or
CTRL-] Jump to the manpage for the
<cWORD> under the cursor. Takes a count for the section.CTRL-T Jump back to the location that the manpage was opened from.gO Show the manpage outline.
gOq :quit if invoked as $MANPAGER, otherwise :close.
Variables:
g:no_man_maps Do not create mappings in manpage buffers.
g:ft_man_folding_enable Fold manpages with foldmethod=indent foldnestmax=1.
b:man_default_sects Comma-separated, ordered list of preferred sections. For example in C one usually wants section 3 or 2:
:let b:man_default_sections = '3,2'
g:man_hardwrap Hard-wrap to $MANWIDTH or window width if $MANWIDTH is empty or larger than the window width. Enabled by default. Set
FALSE to enable soft wrapping.
To use Nvim as a manpager:
export MANPAGER='nvim +Man!'
Note: when running
man from the shell with Nvim as
$MANPAGER,
man willpre-format the manpage using
groff, and Nvim will display the manual page asit was received from stdin (it can't "undo" the hard-wrap caused byman/groff). To prevent man/groff from hard-wrapping the manpage, you can set
$MANWIDTH=999 in your environment.
To disable bold highlighting:
:highlight link manBold Normal
Troubleshooting:
If you see an error like:
fuse: mount failed: Permission denied
this may be caused by AppArmor sandboxing. To fix this, add a local overridein e.g.
/etc/apparmor.d/local/usr.bin.man:
mount fstype=fuse.nvim options=(ro, nosuid, nodev) -> /tmp/**,/usr/bin/fusermount Ux,
See also
https://github.com/neovim/neovim/issues/30268 .
To enable folding use this:
let g:markdown_folding = 1
'expandtab' will be set by default. If you do not want that use this:
let g:markdown_recommended_style = 0
To enable folding use this:
let g:org_folding = 1
Two maps,<C-]> and<C-T>, are provided to simulate a tag stack for navigatingthe PDF. The following are treated as tags:
The byte offset after "startxref" to the xref table
The byte offset after the /Prev key in the trailer to an earlier xref table
A line of the form "0123456789 00000 n" in the xref table
An object reference like "1 0 R" anywhere in the PDF
These maps can be disabled with
:let g:no_pdf_maps = 1
To enable syntax folding in PL/SQL filetypes, set the following variable:
:let g:plsql_fold = 1
By default the following options are set, in accordance with PEP8:
setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
To disable this behavior, set the following variable in your vimrc:
let g:python_recommended_style = 0
Linting of treesitter queries for installed parsers using
vim.treesitter.query.lint() is enabled by default on
BufEnter and
BufWrite. To change the events that trigger linting, use
vim.g.query_lint_on = { 'InsertLeave', 'TextChanged' }
To disable linting completely, set
vim.g.query_lint_on = {}
The quickfix filetype plugin includes configuration for displaying the commandthat produced the quickfix list in the
status-line. To disable this setting,configure as follows:
:let g:qf_disable_statusline = 1
R MARKDOWN
ft-rmd-pluginBy default ftplugin/html.vim is not sourced. If you want it sourced, add toyour
vimrc:
let rmd_include_html = 1
The
'formatexpr' option is set dynamically with different values for R codeand for Markdown code. If you prefer that
'formatexpr' is not set, add toyour
vimrc:
let rmd_dynamic_comments = 0
R RESTRUCTURED TEXT
ft-rrst-pluginThe
'formatexpr' option is set dynamically with different values for R codeand for ReStructured text. If you prefer that
'formatexpr' is not set, add toyour
vimrc:
let rrst_dynamic_comments = 0
The following formatting setting are optionally available:
setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
To enable this behavior, set the following variable in your vimrc:
let g:rst_style = 1
The
'formatexpr' option is set dynamically with different values for R codeand for LaTeX code. If you prefer that
'formatexpr' is not set, add to your
vimrc:
let rnw_dynamic_comments = 0
Since the text for this plugin is rather long it has been put in a separatefile:
pi_spec.txt.
Allows editing binary
shada-files in a nice way. Opened binary files aredisplayed in the following format:
Type with timestamp YYYY-mm-ddTHH:MM:SS: % Key__ Description___ Value + fooba foo bar baz fo {msgpack-value} + abcde abc def ghi jk {msgpack-value}Other type with timestamp YYYY-mm-ddTHH:MM:SS: @ Description__ Value - foo bar baz t {msgpack-value} # Expected more elements in listSome other type with timestamp YYYY-mm-ddTHH:MM:SS: # Unexpected type: type instead of map = {msgpack-value}Filetype plugin defines all
Cmd-events. Defined
SourceCmd event makes"source file.shada" be equivalent to "|:rshada| file.shada".
BufWriteCmd,
FileWriteCmd and
FileAppendCmd events are affected by the followingsettings:
g:shada#keep_old_header Boolean, if set to false all header entriesare ignored when writing. Defaults to 1.
g:shada#add_own_header Boolean, if set to true first written entrywill always be header entry with two values ina map with attached data:
v:version attachedto "version" key and "shada.vim" attached to"generator" key. Defaults to 1.
Format description:
1.
# starts a comment. Lines starting with space characters and then
# are ignored. Plugin may only add comment lines to indicate some errors in ShaDa format. Lines containing no non-whitespace characters are also ignored.2. Each entry starts with line that has format "{type} with timestamp
{timestamp}:".
{timestamp} is
strftime()-formatted string representing actual Unix timestamp value. First strftime() argument is equal to
%Y-%m-%dT%H:%M:%S. When writing this timestamp is parsed using
msgpack#strptime(), with caching (it remembers which timestamp produced particular strftime() output and uses this value if you did not change timestamp).
{type} is one of 1 - Header 2 - Search pattern 3 - Replacement string 4 - History entry 5 - Register 6 - Variable 7 - Global mark 8 - Jump 9 - Buffer list 10 - Local mark 11 - Change * - Unknown (0x{type-hex})
Each type may be represented using Unknown entry: "Jump with timestamp ..." is the same as "Unknown (0x8) with timestamp ....".3. After header there is one of the following lines: 1. " % Key__ Description__ Value": map header. After mapping header follows a table which may contain comments and lines consisting of " +", key, description and
{msgpack-value}. Key is separated by at least two spaces with description, description is separated by at least two spaces with the value. Each key in the map must be at most as wide as "Key__" header: "Key" allows at most 3-byte keys, "Key__" allows at most 5-byte keys. If keys actually occupy less bytes then the rest is filled with spaces. Keys cannot be empty, end with spaces, contain two consequent spaces inside of them or contain multibyte characters (use "=" format if you need this). Descriptions have the same restrictions on width and contents, except that empty descriptions are allowed. Description column may be omitted.
When writing description is ignored. Keys with values
msgpack#equal to default ones are ignored. Order of keys is preserved. All keys are treated as strings (not binary strings).
Note: specifically for buffer list entries it is allowed to have more then one map header. Each map header starts a new map entry inside buffer list because ShaDa buffer list entry is an array of maps. I.e.
Buffer list with timestamp 1970-01-01T00:00:00: % Key Description Value + f file name "/foo" + l line number 1 + c column 10
is equivalent to
Buffer list with timestamp 1970-01-01T00:00:00: = [{="f": "/foo", ="c": 10}] and
Buffer list with timestamp 1970-01-01T00:00:00: % Key Description Value + f file name "/foo" % Key Description Value + f file name "/bar"
is equivalent to
Buffer list with timestamp 1970-01-01T00:00:00: = [{="f": "/foo"}, {="f": "/bar"}] Note 2: specifically for register entries special syntax for arrays was designed:
Register with timestamp 1970-01-01T00:00:00: % Key Description Value + rc contents @ | - "line1" | - "line2"
This is equivalent to
Register with timestamp 1970-01-01T00:00:00: % Key Description Value + rc contents ["line1", "line2"]
Such syntax is automatically used if array representation appears to be too lengthy. 2. " @ Description__ Value": array header. Same as map, but key is omitted and description cannot be omitted. Array entries start with " -". Example:
History entry with timestamp 1970-01-01T00:00:00: @ Description_ Value - history type SEARCH - contents "foo" - separator '/'
is equivalent to
History entry with timestamp 1970-01-01T00:00:00: = [SEARCH, "foo", '/']
Note: special array syntax for register entries is not recognized here. 3. " =
{msgpack-value}": raw values.
{msgpack-value} in this case may have absolutely any type. Special array syntax for register entries is not recognized here as well.
Since the text for this plugin is rather long it has been put in a separatefile:
ft_rust.txt.
Since the text for this plugin is rather long it has been put in a separatefile:
ft_sql.txt.
If the first line of a
*.tex file has the form
%&<format>
then this determined the file type: plaintex (for plain TeX), context (forConTeXt), or tex (for LaTeX). Otherwise, the file is searched for keywords tochoose context or tex. If no keywords are found, it defaults to plaintex.You can change the default by defining the variable g:tex_flavor to the format(not the file type) you use most. Use one of these:
let g:tex_flavor = "plain"let g:tex_flavor = "context"let g:tex_flavor = "latex"
Currently no other formats are recognized.
To enable:
let g:typst_folding = 1
To disable:
let g:typst_foldnested = 0
The Vim filetype plugin defines mappings to move to the start and end offunctions with [[ and ]]. Move around comments with ]" and [".
The mappings can be disabled with:
let g:no_vim_maps = 1
By default, the YAML filetype plugin enables the following options:
setlocal shiftwidth=2 softtabstop=2
To disable this, set the following variable:
let g:yaml_recommended_style = 0
g:zig_std_dirThe path to the Zig standard library. The Zig
ftplugin reads
g:zig_std_dirand appends it to the
'path' for Zig files. Where the Zig standard libraryis located is system and installation method dependent.
One can automatically set
g:zig_std_dir using
zig env:
let g:zig_std_dir = json_decode(system('zig env'))['std_dir']This can, for example, be put in a FileType
:autocmd or user
ftplugin toonly load when a Zig file is opened.
The Zimbu filetype plugin defines mappings to move to the start and end offunctions with [[ and ]].
The mappings can be disabled with:
let g:no_zimbu_maps = 1