List of Vim Variables¶
This is a list of the Vim-builtin (v:) variables.
Most Useful¶
$NVIM_APPNAME: Use to isolate nvim instances.-
v:servername: Primary listen-address of Nvim, the first item returned byserverlist().- See also
serverstart()serverstop(). v:shell_error: Result of the last shell command. When non-zero, the last shell command had an error.
- See also
-
v:stderr:channel-idcorresponding to stderr. The value is always 2;- This variable just makes your code more descriptive.
- Unlike stdin and stdout (see
stdioopen()), stderr is always open for writing.
-
v:swapchoice:SwapExistsautocommands can set this to the selected choice for handling an existing swapfile:'o': Open read-only'e': Edit anyway'r': Recover'd': Delete swapfile'q': Quit'a': Abortv:true: Special value used to put "true" in JSON and msgpack. one
-
v:warningmsg: Last given warning message.- Modifiable (can be set).
-
v:lua: Prefix for calling Lua functions from expressions.
All Variables¶
All variables found in :h vim-variable (or v:var/v:)
v:argv: The CLI arguments passed to vim.v:char: Arg for evaluatingformatexprv:charconvert_from: The name of the character encoding of a file to be converted.- Only valid while evaluating the 'charconvert' option.
v:charconvert_to: The name of the character encoding of a file after conversion.- Only valid while evaluating the 'charconvert' option.
-
v:cmdarg: The extra arguments ("++p", "++enc=", "++ff=") given to a file read /write command. -
v:collate: The current locale setting for collation order of the runtime environment. -
v:cmdbang: Set like v:cmdarg for a file read/write command.- When a "!" was used the value is 1, otherwise it is 0.
-
v:completed_item: Dictionary containing the most recentcomplete-itemsafterCompleteDone. -
v:count: The count given for the last Normal mode command. v:count1: Just like "v:count", but defaults to one when no count is used.v:ctype: The current locale setting for characters of the runtime environment.v:dying: Normally zero. When a deadly signal is caught it's set to one.-
v:echospace: Number of screen cells that can be used for an:echomessage in the last screen line before causing thehit-enter-prompt. -
v:errmsg: Last given error message. Modifiable (can be set). v:errors: Errors found by assert functions, such asassert_true().v:event: Dictionary of event data for the currentautocommand.v:exception: The value of the exception most recently caught and not finished.-
v:exiting: Exit code, orv:nullbefore invoking theVimLeavePreandVimLeaveautocmds. -
v:false: Special value used to put "false" in JSON and msgpack. v:fcs_choice: What should happen after aFileChangedShellevent was triggered.v:fcs_reason: The reason why theFileChangedShellevent was triggered.
v:fname: When evaluating'includeexpr': the file name that was detected. Empty otherwise.v:fname_diff: The name of the diff (patch) file.- Only valid while evaluating
'patchexpr'.
- Only valid while evaluating
-
v:fname_in/v:fname_out: The name of the input / output file.- Valid while evaluating:
'charconvert': file to be converted'diffexpr': original file'patchexpr': original file
- Valid while evaluating:
-
v:fname_new: The name of the new version of the file. Only valid while evaluating'diffexpr'.
v:folddashes: Used for 'foldtext': dashes representing foldlevel of a closed fold.v:foldend: Used for 'foldtext': last line of closed fold.v:foldlevel: Used for 'foldtext': foldlevel of closed fold.-
v:foldstart: Used for 'foldtext': first line of closed fold. -
v:hlsearch: Variable that indicates whether search highlighting is on.- Setting it makes sense only if
'hlsearch'is enabled. - Setting this variable to
0acts like the:nohlsearchcommand. - Setting it to
1acts like:
- Setting it makes sense only if
-
v:insertmode: Used for theInsertEnterandInsertChangeautocommand events. v:key: Key of the current item of aDictionary.- Only valid while evaluating the expression used with
map()andfilter().
- Only valid while evaluating the expression used with
v:lang: The current locale setting for messages of the runtime environment.-
v:lc_time: The current locale setting for time messages of the runtime environment. -
v:lnum: Line number for thefoldexprfold-expr,formatexpr,indentexprandstatuscolumnexpressions, tab page number forguitablabelandguitabtooltip. -
v:lua: Prefix for calling Lua functions from expressions. -
v:maxcol: Maximum line length.- Depending on where it is used it can be screen columns, characters or bytes.
-
v:mouse_col: Column number for a mouse click obtained withgetchar().- This is the screen column number, like with
virtcol().
- This is the screen column number, like with
v:mouse_lnum: Line number for a mouse click obtained withgetchar().- This is the text line number, not the screen line number.
v:mouse_win: Window number for a mouse click obtained withgetchar().- First window has number 1, like with
winnr().
- First window has number 1, like with
v:mouse_winid:window-IDfor a mouse click obtained withgetchar().-
v:msgpack_types: Dictionary containing msgpack types used bymsgpackparse()andmsgpackdump(). -
v:null: Special value used to put "null" in JSON and NIL in msgpack. -
v:numbermax: Maximum value of a number. -
v:numbermin: Minimum value of a number (negative). -
v:numbersize: Number of bits in a Number.- This is normally 64, but on some systems it may be 32.
v:oldfiles: List of file names that is loaded from theshadafile on startup.v:operator: The last operator given in Normal mode.-
v:option_command: Command used to set the option. Valid while executing anOptionSetautocommand. -
v:option_new: New value of the option. Valid while executing anOptionSetautocommand. -
v:option_old: Old value of the option. Valid while executing anOptionSetautocommand. -
v:option_oldglobal: Old global value of the option. Valid while executing anOptionSetautocommand. -
v:option_oldlocal: Old local value of the option. Valid while executing anOptionSetautocommand. -
v:option_type: Scope of the set command. Valid while executing anOptionSetautocommand.- Can be either "global" or "local "
-
v:prevcount: The count given for the last but one Normal mode command. -
v:profiling: Normally zero. Set to one after using ":profile start". Seeprofiling -
v:progname: The name by which Nvim was invoked (with path removed). -
v:progpath: Absolute path to the current running Nvim. -
v:register: The name of the register in effect for the current normal mode command (regardless of whether that command actually used a register). -
v:relnum: Relative line number for the 'statuscolumn' expression. -
v:scrollstart: String describing the script or function that caused the screen to scroll up.- It's only set when it is empty, thus the first reason is remembered.
- It is set to "Unknown" for a typed command.
- This can be used to find out why your script causes the hit-enter prompt.
-
v:searchforward: Search direction: 1 after a forward search, 0 after a backward search. -
v:servername: Primary listen-address of Nvim, the first item returned byserverlist(). -
v:shell_error: Result of the last shell command. When non-zero, the last shell command had an error. -
v:statusmsg: Last given status message. Modifiable (can be set). -
v:stderr:channel-idcorresponding to stderr. The value is always 2.- Use this variable to make your code more descriptive.
-
v:swapchoice:SwapExistsautocommands can set this to the selected choice for handling an existing swapfile:'o': Open read-only'e': Edit anyway'r': Recover'd': Delete swapfile'q': Quit'a': Abort
-
v:swapcommand: Normal mode command to be executed after a file has been opened. -
v:swapname: Name of the swapfile found. Only valid duringSwapExistsevent. -
v:t_TYPE: Value of theTYPEtype, whereTYPEis one of:v:t_blob: Value ofBlobtype.v:t_bool: Value ofBooleantype.v:t_dict: Value ofDictionarytype.v:t_float: Value ofFloattype.v:t_func: Value ofFuncreftype.v:t_list: Value ofListtype.v:t_number: Value ofNumbertype.v:t_string: Value ofStringtype.
-
v:termrequest: The value of the most recent OSC or DCS control sequence sent from a process running in the embeddedterminal. -
v:termresponse: The value of the most recent OSC or DCS control sequence received by Nvim from the terminal. -
v:testing: Must be set before usingtest_garbagecollect_now(). v:this_session: Full filename of the last loaded or saved session file.-
v:throwpoint: The point where the exception most recently caught and not finished was thrown.- Not set when commands are typed.
-
v:true: Special value used to put "true" in JSON and msgpack. -
v:val: Value of the current item of aListorDictionary.- Only valid while evaluating the expression used with
map()andfilter().
- Only valid while evaluating the expression used with
-
v:version: Vim version number: major version times 100 plus minor version. v:vim_did_enter: 0 during startup, 1 just beforeVimEnter.v:virtnum: Virtual line number for the 'statuscolumn' expression.-
v:warningmsg: Last given warning message.- Modifiable (can be set).
-
v:windowid: Application-specific window "handle" which may be set by any attached UI.- Defaults to zero.
- Note: For Nvim
windowsusewinnr()orwin_getid(), seewindow-ID.