NeoVim Options English F - Glory-Day/Configurations GitHub Wiki

fileencoding

Type

string (default: "")

Scope

local to buffer

Description

File-content encoding for the current buffer. Conversion is done with iconv() or as specified with 'charconvert'.

When 'fileencoding' is not UTF-8, conversion will be done when writing the file. For reading see below.
When 'fileencoding' is empty, the file will be saved with UTF-8 encoding (no conversion when reading or writing a file).

WARNING

Conversion to a non-Unicode encoding can cause loss of information!

See encoding-names for the possible values. Additionally, values may be specified that can be handled by the converter, see mbyte-conversion.

When reading a file 'fileencoding' will be set from 'fileencodings'. To read a file in a certain encoding it won't work by setting 'fileencoding', use the ++enc argument. One exception: when 'fileencodings' is empty the value of 'fileencoding' is used.
For a new file the global value of 'fileencoding' is used.

Prepending "8bit-" and "2byte-" has no meaning here, they are ignored.
When the option is set, the value is converted to lowercase. Thus you can set it with uppercase values too. '_' characters are replaced with '-'. If a name is recognized from the list at encoding-names, it is replaced by the standard name. For example "ISO8859-2" becomes "iso-8859-2".

When this option is set, after starting to edit a file, the 'modified' option is set, because the file would be different when written.

Keep in mind that changing 'fenc' from a modeline happens AFTER the text has been read, thus it applies to when the file will be written. If you do set 'fenc' in a modeline, you might want to set 'nomodified' to avoid not being able to ":q".

This option cannot be changed when 'modifiable' is off.


fileencodings

Type

string (default: "ucs-bom,utf-8,default,latin1")

Scope

global

Description

This is a list of character encodings considered when starting to edit an existing file. When a file is read, Vim tries to use the first mentioned character encoding. If an error is detected, the next one in the list is tried. When an encoding is found that works, 'fileencoding' is set to it. If all fail, 'fileencoding' is set to an empty string, which means that UTF-8 is used.

WARNING

Conversion can cause loss of information! You can use the ++bad argument to specify what is done with characters that can't be converted.

For an empty file or a file with only ASCII characters most encodings will work and the first entry of 'fileencodings' will be used (except "ucs-bom", which requires the BOM to be present). If you prefer another encoding use an BufReadPost autocommand event to test if your preferred encoding is to be used. Example:

au BufReadPost * if search('\S', 'w') == 0 |
    \ set fenc=iso-2022-jp | endif

This sets 'fileencoding' to "iso-2022-jp" if the file does not containnon-blank characters.
When the ++enc argument is used then the value of 'fileencodings' is not used.
Note that 'fileencodings' is not used for a new file, the global value of 'fileencoding' is used instead. You can set it with:

:setglobal fenc=iso-8859-2

This means that a non-existing file may get a different encoding than an empty file.
The special value "ucs-bom" can be used to check for a Unicode BOM (Byte Order Mark) at the start of the file. It must not be preceded by "utf-8" or another Unicode encoding for this to work properly.
An entry for an 8-bit encoding (e.g., "latin1") should be the last, because Vim cannot detect an error, thus the encoding is always accepted.
The special value "default" can be used for the encoding from the environment. It is useful when your environment uses a non-latin1 encoding, such as Russian.
When a file contains an illegal UTF-8 byte sequence it won't be recognized as "utf-8". You can use the 8g8 command to find the illegal byte sequence.

WRONG VALUES WHAT'S WRONG
latin1,utf-8 "latin1" will always be used
utf-8,ucs-bom,latin1 BOM won't be recognized in an utf-8 file
cp1250,latin1 "cp1250" will always be used

If 'fileencodings' is empty, 'fileencoding' is not modified.
See 'fileencoding' for the possible values.
Setting this option does not have an effect until the next time a file is read.


fileformat

Type

string (Windows default: "dos", Unix default: "unix")

Scope

local to buffer

Description

This gives the of the current buffer, which is used for reading/writing the buffer from/to a file:

Value EOL
dos
unix
mac

When "dos" is used, CTRL-Z at the end of a file is ignored.
See file-formats and file-read.
For the character encoding of the file see 'fileencoding'.
When 'binary' is set, the value of 'fileformat' is ignored, file I/O works like it was set to "unix".
This option is set automatically when starting to edit a file and 'fileformats' is not empty and 'binary' is off.
When this option is set, after starting to edit a file, the 'modified' option is set, because the file would be different when written.
This option cannot be changed when 'modifiable' is off.


fileformats

Type

string (default: Win32: "dos,unix", Unix: "unix,dos")

Scope

global

Description

This gives the end-of-line () formats that will be tried when starting to edit a new buffer and when reading a file into an existing buffer:

  • When empty, the format defined with 'fileformat' will be used always. It is not set automatically.

  • When set to one name, that format will be used whenever a new buffer is opened. 'fileformat' is set accordingly for that buffer. The 'fileformats' name will be used when a file is read into an existing buffer, no matter what 'fileformat' for that buffer is set to.

  • When more than one name is present, separated by commas, automatic detection will be done when reading a file. When starting to edit a file, a check is done for the : 1. If all lines end in , and 'fileformats' includes "dos", 'fileformat' is set to "dos". 2. If a is found and 'fileformats' includes "unix", 'fileformat' is set to "unix". Note that when a is found without a preceding , "unix" is preferred over "dos". 3. If 'fileformat' has not yet been set, and if a is found, and if 'fileformats' includes "mac", 'fileformat' is set to "mac". This means that "mac" is only chosen when: "unix" is not present or no is found in the file, and "dos" is not present or no is found in the file. Except: if "unix" was chosen, but there is a before the first , and there appear to be more s than s in the first few lines, "mac" is used. 4. If 'fileformat' is still not set, the first name from 'fileformats' is used. When reading a file into an existing buffer, the same is done, but this happens like 'fileformat' has been set appropriately for that file only, the option is not changed. When 'binary' is set, the value of 'fileformats' is not used. When Vim starts up with an empty buffer the first item is used. You can overrule this by setting 'fileformat' in your .vimrc.

    For systems with a Dos-like (), when reading files that are ":source"ed and for vimrc files, automatic detection may be done:

  • When 'fileformats' is empty, there is no automatic detection. Dos format will be used.

  • When 'fileformats' is set to one or more names, automatic detection is done. This is based on the first in the file: If there is a in front of it, Dos format is used, otherwise Unix format is used. Also see file-formats.


fileignorecase

Type

boolean (default on for systems where case in file names is normally ignored)

Scope

global

Description

When set case is ignored when using file names and directories.
See 'wildignorecase' for only ignoring case when doing completion.


filetype

Type

string (default: "")

Scope

local to buffer

Description

When this option is set, the FileType autocommand event is triggered.
All autocommands that match with the value of this option will be executed. Thus the value of 'filetype' is used in place of the file name.
Otherwise this option does not always reflect the current file type.
This option is normally set when the file type is detected. To enable this use the ":filetype on" command. :filetype
Setting this option to a different value is most useful in a modeline, for a file for which the file type is not automatically recognized.
Example, for in an IDL file:

/* vim: set filetype=idl : */

FileType filetypes
When a dot appears in the value then this separates two filetype names. Example:

/* vim: set filetype=c.doxygen : */

This will use the "c" filetype first, then the "doxygen" filetype.
This works both for filetype plugins and for syntax files. More than one dot may appear.
This option is not copied to another buffer, independent of the 's' or 'S' flag in 'cpoptions'.
Only normal file name characters can be used, "/*?[|<>" are illegal.


fillchars

Type

string (default "")

Scope

global or local to window global-local

Description

Characters to fill the statuslines, vertical separators and special lines in the window.
It is a comma-separated list of items. Each item has a name, a colon and the value of that item:

Value Default Used for
stl ' ' or '^' statusline of the current window
stlnc ' ' or '=' statusline of the non-current windows
wbr ' ' window bar
horiz '─' or '-' horizontal separators :split
horizup '┴' or '-' upwards facing horizontal separator
horizdown '┬' or '-' downwards facing horizontal separator
vert '│' or ' '
vertleft '┤' or ' '
vertright '├' or ' '
verthoriz '┼' or '+' overlapping vertical and horizontal separator
fold '·' or '-' filling 'foldtext'
foldopen '-' mark the beginning of a fold
foldclose '+' show a closed fold
foldsep '│' or ' '
diff '-' deleted lines of the 'diff' option
msgsep ' ' message separator 'display'
eob '~' empty lines at the end of a buffer
lastline '@' 'display' contains lastline/truncate

Any one that is omitted will fall back to the default. For "stl" and "stlnc" the space will be used when there is highlighting, '^' or '=' otherwise.

Note that "horiz", "horizup", "horizdown", "vertleft", "vertright" and "verthoriz" are only used when 'laststatus' is 3, since only vertical window separators are used otherwise.

If 'ambiwidth' is "double" then "horiz", "horizup", "horizdown", "vert", "vertleft", "vertright", "verthoriz", "foldsep" and "fold" default to single-byte alternatives.

Example:

:set fillchars=stl:^,stlnc:=,vert:│,fold:·,diff:-

This is similar to the default, except that these characters will also be used when there is highlighting.

For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items single-byte and multibyte characters are supported. But double-width characters are not supported.

The highlighting used for these items:

Value Highlight Group
stl StatusLine hl-StatusLine
stlnc StatusLineNC hl-StatusLineNC
wbr WinBar hl-WinBar or hl-WinBarNC
horiz WinSeparator hl-WinSeparator
horizup WinSeparator hl-WinSeparator
horizdown WinSeparator hl-WinSeparator
vert WinSeparator hl-WinSeparator
vertleft WinSeparator hl-WinSeparator
vertright WinSeparator hl-WinSeparator
verthoriz WinSeparator hl-WinSeparator
fold Folded hl-Folded
diff DiffDelete hl-DiffDelete
eob EndOfBuffer hl-EndOfBuffer
lastline NonText hl-NonText

fixendofline

Type

boolean (default on)

Scope

local to buffer

Description

When writing a file and this option is on, at the end of file will be restored if missing. Turn this option off if you want to preserve the situation from the original file.
When the 'binary' option is set the value of this option doesn't matter.
See the 'endofline' option.
See eol-and-eof for example settings.


foldclose

Type

string (default "")

Scope

global

Description

When set to "all", a fold is closed when the cursor isn't in it and its level is higher than 'foldlevel'. Useful if you want folds to automatically close when moving out of them.


foldcolumn

Type

string (default "0")

Scope

local to window

Description

When and how to draw the foldcolumn. Valid values are:

Value Effect
"auto" resize to the minimum amount of folds to display.
"auto:[1-9]" resize to accommodate multiple folds up to the selected level
0 to disable foldcolumn
"[1-9]" to display a fixed number of columns

See folding.


foldenable

Type

boolean (default on)

Scope

local to window

Description

When off, all folds are open. This option can be used to quickly switch between showing all text unfolded and viewing the text with folds (including manually opened or closed folds). It can be toggled with the zi command. The 'foldcolumn' will remain blank when 'foldenable' is off.
This option is set by commands that create a new fold or close a fold.
See folding.


foldexpr

Type

string (default: "0")

Scope

local to window

Description

The expression used for when 'foldmethod' is "expr". It is evaluated for each line to obtain its fold level. The context is set to the script where 'foldexpr' was set, script-local items can be accessed.
See fold-expr for the usage.

The expression will be evaluated in the sandbox if set from a modeline, see sandbox-option.
This option can't be set from a modeline when the 'diff' option is on or the 'modelineexpr' option is off.

It is not allowed to change text or jump to another window while evaluating 'foldexpr' textlock.


foldignore

Type

string (default: "#")

Scope

local to window

Description

Used only when 'foldmethod' is "indent". Lines starting with characters in 'foldignore' will get their fold level from surrounding lines. White space is skipped before checking for this character.
The default "#" works well for C programs. See fold-indent.


foldlevel

Type

number (default: 0)

Scope

local to window

Description

Sets the fold level: Folds with a higher level will be closed.
Setting this option to zero will close all folds. Higher numbers will close fewer folds.
This option is set by commands like zm, zM and zR.
See fold-foldlevel.


foldlevelstart

Type

number (default: -1)

Scope

global

Description

Sets 'foldlevel' when starting to edit another buffer in a window.
Useful to always start editing with all folds closed (value zero), some folds closed (one) or no folds closed (99).
This is done before reading any modeline, thus a setting in a modeline overrules this option. Starting to edit a file for diff-mode also ignores this option and closes all folds.
It is also done before BufReadPre autocommands, to allow an autocmd to overrule the 'foldlevel' value for specific files.
When the value is negative, it is not used.


foldmarker

Type

string (default: "{{{,}}}")

Scope

local to window

Description

The start and end marker used when 'foldmethod' is "marker". There must be one comma, which separates the start and end marker. The marker is a literal string (a regular expression would be too slow).
See fold-marker.


foldmethod

Type

string (default: "manual")

Scope

local to window

Description

The kind of folding used for the current window. Possible values:

Value Used Effect
fold-manual manual Folds are created manually.
fold-indent indent Lines with equal indent form a fold.
fold-expr expr 'foldexpr' gives the fold level of a line.
fold-marker marker Markers are used to specify folds.
fold-syntax syntax Syntax highlighting items specify folds.
fold-diff diff Fold text that is not changed.

foldminlines

Type

number (default: 1)

Scope

local to window

Description

Sets the number of screen lines above which a fold can be displayed closed. Also for manually closed folds. With the default value of one a fold can only be closed if it takes up two or more screen lines.
Set to zero to be able to close folds of just one screen line.
Note that this only has an effect on what is displayed. After using "zc" to close a fold, which is displayed open because it's smaller than 'foldminlines', a following "zc" may close a containing fold.


foldnestmax

Type

number (default: 20)

Scope

local to window

Description

Sets the maximum nesting of folds for the "indent" and "syntax" methods. This avoids that too many folds will be created. Using more than 20 doesn't work, because the internal limit is 20.


foldopen

Type

string (default: "block,hor,mark,percent,quickfix,search,tag,undo")

Scope

global

Description

Specifies for which type of commands folds will be opened, if the command moves the cursor into a closed fold. It is a comma-separated list of items.

NOTE

When the command is part of a mapping this option is not used.

Add the zv command to the mapping to get the same effect. (rationale: the mapping may want to control opening folds itself)

Value Commands
all any
block "(", "{", "[[", "[{", etc.
hor horizontal movements: "l", "w", "fx", etc.
insert any command in Insert mode
jump far jumps: "G", "gg", etc.
mark jumping to a mark: "'m", CTRL-O, etc.
percent "%"
quickfix ":cn", ":crew", ":make", etc.
search search for a pattern: "/", "n", "*", "gd", etc. (not for a search pattern in a ":" command)
Also for [s and ]s.
tag jumping to a tag: ":ta", CTRL-T, etc.
undo undo or redo: "u" and CTRL-R

When a movement command is used for an operator (e.g., "dl" or "y%") this option is not used. This means the operator will include the whole closed fold.
Note that vertical movements are not here, because it would make it very difficult to move onto a closed fold.
In insert mode the folds containing the cursor will always be open when text is inserted.
To close folds you can re-apply 'foldlevel' with the zx command or set the 'foldclose' option to "all".


foldtext

Type

string (default: "foldtext()")

Scope

local to window

Description

An expression which is used to specify the text displayed for a closed fold. The context is set to the script where 'foldexpr' was set, script-local items can be accessed. See fold-foldtext for the usage.

The expression will be evaluated in the sandbox if set from a modeline, see sandbox-option.
This option cannot be set in a modeline when 'modelineexpr' is off.

It is not allowed to change text or jump to another window while evaluating 'foldtext' textlock.


formatexpr

Type

string (default "")

Scope

local to buffer

Description

Expression which is evaluated to format a range of lines for the gq operator or automatic formatting (see 'formatoptions'). When this option is empty 'formatprg' is used.

The v:lnum variable holds the first line to be formatted.
The v:count variable holds the number of lines to be formatted.
The v:char variable holds the character that is going to be inserted if the expression is being evaluated due to automatic formatting. This can be empty. Don't insert it yet!

Example:

:set formatexpr=mylang#Format()

This will invoke the mylang#Format() function in the autoload/mylang.vim file in 'runtimepath'. autoload

The expression is also evaluated when 'textwidth' is set and adding text beyond that limit. This happens under the same conditions as when internal formatting is used. Make sure the cursor is kept in the same spot relative to the text then! The mode() function will return "i" or "R" in this situation.

When the expression evaluates to non-zero Vim will fall back to using the internal format mechanism.

If the expression starts with s: or , then it is replaced with the script ID (local-function). Example:

set formatexpr=s:MyFormatExpr()
set formatexpr=<SID>SomeFormatExpr()

Otherwise, the expression is evaluated in the context of the script where the option was set, thus script-local items are available.

The expression will be evaluated in the sandbox when set from a modeline, see sandbox-option. That stops the option from working, since changing the buffer text is not allowed.
This option cannot be set in a modeline when 'modelineexpr' is off.

NOTE

This option is set to "" when 'compatible' is set.


formatlistpat

Type

string (default: "^\s*\d+[]:.)}\t ]\s*")

Scope

local to buffer

Description

A pattern that is used to recognize a list header. This is used for the "n" flag in 'formatoptions'.
The pattern must match exactly the text that will be the indent for the line below it. You can use /\ze to mark the end of the match while still checking more characters. There must be a character following the pattern, when it matches the whole line it is handled like there is no match.
The default recognizes a number, followed by an optional punctuation character and white space.


formatoptions

Type

string (default: "tcqj")

Scope

local to buffer

Description

This is a sequence of letters which describes how automatic formatting is to be done. See fo-table. Commas can be inserted for readability.
To avoid problems with flags that are added in the future, use the "+=" and "-=" feature of ":set" add-option-flags.

formatprg

Type

string (default "")

Scope

global or local to buffer global-local

Description

The name of an external program that will be used to format the lines selected with the gq operator. The program must take the input on stdin and produce the output on stdout. The Unix program "fmt" is such a program.
If the 'formatexpr' option is not empty it will be used instead.
Otherwise, if 'formatprg' option is an empty string, the internal format function will be used C-indenting.
Environment variables are expanded :set_env. See option-backslash about including spaces and backslashes.
This option cannot be set from a modeline or in the sandbox, for security reasons.


fsync

Type

boolean (default off)

Scope

global

Description

When on, the OS function fsync() will be called after saving a file (:write, writefile(), …), swap-file, undo-persistence and shada-file.
This flushes the file to disk, ensuring that it is safely written.
Slow on some systems: writing buffers, quitting Nvim, and other operations may sometimes take a few seconds.

Files are ALWAYS flushed ('fsync' is ignored) when:

  • CursorHold event is triggered
  • :preserve is called
  • system signals low battery life
  • Nvim exits abnormally

This option cannot be set from a modeline or in the sandbox, for security reasons.

⚠️ **GitHub.com Fallback** ⚠️