various.txt ForVim version 9.1. Last change: 2025 Jun 28VIM REFERENCE MANUAL by Bram MoolenaarVarious commandsvarious1. Various commandsvarious-cmds2. Using Vim likeless or moreless==============================================================================1. Various commandsvarious-cmdsCTRL-LCTRL-LClear and redraw the screen. The redraw may happenlater, after processing typeahead.:redr:redraw:redr[aw][!]Redraw the screen right now. When!is includeditiscleared first.It can be used to redraw the screen inascriptor function (oramapping if'lazyredraw'is set).:redraws:redrawstatus:redraws[tatus][!]Redraw the status line of the current window. When!is included all status lines are redrawn.Useful to update the status line(s) when'statusline'includes an item that doesn't cause automaticupdating.If the command lineis being edited the redrawispostponed until later.:redrawt:redrawtabline:redrawt[abline]Redraw the tabline. Useful to update the tabline when'tabline' includes an item that doesn't triggerautomatic updating.E1547:redrawtabp:redrawtabpanel:redrawtabp[anel]Redraw thetabpanel Useful to update thetabpanelwhen'tabpanel' includes an item that doesn't triggerautomatic updating.N<Del><Del>When enteringa number: Remove the last digit.Note: if you like to use<BS> for this, add thismapping to your .vimrc::map CTRL-V <BS> CTRL-V <Del>See:fixdel if your<Del> key does notdo what youwant.:as[cii]orga:as:asciigaPrint the ascii value of the character under thecursor in decimal, hexadecimal and octal.Mnemonic: Get Ascii value.For example, when the cursoris ona 'R':<R> 82, Hex 52, Octal 122When the characterisa non-standard ASCII character,but printable according to the'isprint' option, thenon-printable versionis also given.When the characteris larger than 127, the<M-x> formis also printed. For example:<~A> <M-^A> 129, Hex 81, Octal 201<p> <|~> <M-~> 254, Hex fe, Octal 376(where<p>isa special character)The<Nul> character ina fileis stored internallyas<NL>, butit will be shown as:<^@> 0, Hex 00, Octal 000If the character has composing characters these arealso shown. The value of'maxcombine' doesn't matter.If the character can be insertedasa digraph, alsooutput the two characters that can be used to createthe character:<ö> 246, Hex 00f6, Oct 366, Digr o:This shows you can typeCTRL-Ko: toinsert ö.g8g8Print the hex values of the bytes used in thecharacter under the cursor, assumingitis inUTF-8encoding. This also shows composing characters. Thevalue of'maxcombine' doesn't matter.Example ofa character with two composing characters:e0 b8 81 + e0 b8 b9 + e0 b9 898g88g8Find an illegalUTF-8 byte sequenceat or after thecursor. This works in two situations:1. when'encoding'is any 8-bit encoding2. when'encoding'is "utf-8" and'fileencoding'is any 8-bit encodingThusit can be used when editinga file that wassupposed to beUTF-8 but was readas ifitis an 8-bitencoding becauseit contains illegal bytes.Does not wrap around theend of the file.Note that when the cursoris on an illegal byte or thecursoris halfwayamultibyte character the commandwon't move the cursor.:p:pr:printE749:[range]p[rint][flags]Print[range] lines (default current line). Can alsobe spelled:[range]| due toVi compatibility (see:bar). Gives an error in an empty buffer.Note: If you are looking fora way to print your texton paper see:hardcopy. In theGUI you can use theFile.Print menu entry.Seeex-flags for[flags].The:filter command can be used to only show linesmatchinga pattern.:[range]p[rint]{count}[flags]Print{count} lines,starting with[range] (defaultcurrent linecmdline-ranges).Seeex-flags for[flags].:P:Print:[range]P[rint][count][flags]Justas ":print". Was apparently added toVi forpeople that keep theshift key pressed too long...This commandis not supported inVim9 script.Note:A user command can overrule this command.Seeex-flags for[flags].:l:list:[range]l[ist][count][flags]Sameas :print, but display unprintable characterswith '^' andput$ after the line. This can befurther changed with the'listchars' option.Seeex-flags for[flags].:nu:number:[range]nu[mber][count][flags]Sameas :print, but precede each line with its linenumber. (See also'highlight' and'numberwidth'option).Seeex-flags for[flags].:#:[range]#[count][flags]synonym for :number.:#!vim-shebang:#!{anything}Ignored, so that you can starta Vimscript with:#!vim -Slet mylogbook='$HOME/logbook.md'exe $':e {mylogbook}'$put ='## ' .. strftime('%d. %b %Y')norm! oMake thatscript executable and runit to createanew diary entry.:zE144:[range]z[+-^.=][count]Display several lines of text surrounding the linespecified with[range], or around the current lineif thereis no[range].If thereisa[count], that's how many lines you'llsee; if thereis no[count] and only onewindow thentwice the value of the'scroll' optionis used,otherwise the currentwindow height minus 3is used.Thisis the value of "scr" in the table below.If thereisa[count] the'window' optionis set toits value.:z can be used either alone or followed by any ofseveral marks. These have the following effect:mark first line last line new cursor line---- ---------- --------- ------------+ current line 1 scr forward 1 scr forward- 1 scr back current line current line^ 2 scr back 1 scr back 1 scr back. 1/2 scr back 1/2 scr fwd 1/2 scr fwd= 1/2 scr back 1/2 scr fwd current lineSpecifying nomarkat allis the sameas "+".If themarkis "=",a line of dashesis printedaround the current line.:z!:[range]z![+-^.=][count]Like ":z", but when[count]is not specified,itdefaults to the Vimwindow height minus one.:[range]z[!]#[+-^.=][count]:z#Like ":z" or ":z!", but number the lines.:=:=[flags]Print the last line number.Seeex-flags for[flags].:{range}=[flags]Prints the last line number in{range}. For example,this prints the current line number::.=Seeex-flags for[flags].:norm[al][!]{commands}:norm:normalExecuteNormal mode commands{commands}. This makesit possible to executeNormal mode commands typed onthe command-line.{commands} are executed like theyare typed. Forundo all commands are undone together.Execution stops when an erroris encountered.If the [!]is given, mappings will not be used.Without it, when this commandis called fromanon-remappablemapping(:noremap), the argument canbe mapped anyway.{commands} should bea complete command. If{commands} does not finisha command, the last onewill be abortedas if<Esc> or<C-C> was typed.This implies that aninsert commandmust be completed(to startInsert mode, see:startinsert).A ":"commandmust be completedas well. And you can't use"Q" or "gQ" to startEx mode.The displayis not updated while ":normal"is busy.{commands} cannot start witha space. Putacount of1 (one) before it, "1 "is one space.The'insertmode' optionis ignored for{commands}.This command cannot be followed by another command,since any'|'is considered part of the command.This command can be used recursively, but the depthislimited by'maxmapdepth'.An alternativeis to use:execute, which uses anexpressionas argument. This allows the use ofprintable characters to represent special characters.Example::exe "normal \<c-w>\<c-w>":{range}norm[al][!]{commands}:normal-rangeExecuteNormal mode commands{commands} for each linein the{range}. Before executing the{commands}, thecursoris positioned in the first column of the range,for each line. Otherwise it's the sameas the":normal" command withouta range.:sh:shellE371:sh[ell]This command startsa shell. When the shell exits(after the "exit" command) you return to Vim. Thename for the shell command comes from'shell' option.E360Note: This doesn't work when Vim on theAmiga wasstarted in QuickFix mode froma compiler, because thecompiler will have set stdin toa non-interactivemode.:!cmd:!:!{cmd}Execute{cmd} with the shell. See also the'shell'and'shelltype' option. For thefilter command, see:range!.Vim builds command line usingoptions'shell','shcf','sxq' and'shq' in the following order:`&sh &shcf &sxq &shq{cmd} &shq &sxq`So setting both'sxq' and'shq'is possible but rarelyuseful. Additional escaping inside{cmd} may alsobe due to'sxe' option.Also, allcmdline-special characters in{cmd} arereplaced by Vim before passing them to shell.E34Any '!' in{cmd}is replaced with the previousexternal command (see also'cpoptions'). But not whenthereisabackslash before the '!', then thatbackslashis removed. Example: ":!ls" followed by":!echo! \! \\!" executes "echo ls! \!".A'|' in{cmd}is passed to the shell, you cannot useit to appenda Vim command. See:bar.If{cmd} contains "%"itis expanded to the currentfile name, "#"is expanded to the alternate file name.Special characters in the file name are not escaped,usequotes to avoid their special meaning::!ls "%"If the file name containsa "$" then singlequotesmight work better, but this only works if the filename does not containa singlequote::!ls '%'This should always work, but it's more typing::exe "!ls " .. shellescape(expand("%"))To geta literal "%" or "#" prependit withabackslash. For example, tolist all filesstartingwith "%"::!ls \%*A newline character ends{cmd}, what followsisinterpretedasa following ":" command. However, ifthereisabackslash before the newlineitis removedand{cmd} continues. It doesn't matter how manybackslashes are before the newline, only oneisremoved.OnUnix the command normally runs ina non-interactiveshell. If you want an interactive shell to be used(to use aliases) set'shellcmdflag' to "-ic".ForWin32 also see:!start.After the command has been executed, thetimestamp andsize of the current fileis checkedtimestamp.Vim redraws the screen after the commandis finished,becauseit may have printed any text. This requiresahit-enter prompt, so that you can read any messages.To avoid this use::silent !{cmd}The screenis not redrawn then, thus you have to useCTRL-L or ":redraw!" if the command did displaysomething. However, this depends on what thet_tiandt_tetermcap entries are set to.Hint: use:terminal command if you want to run{cmd}in Vim window. `:term ++shell ++close{cmd}` couldserveas close approximation to what:!{cmd} does.:!!:!!Repeat last ":!{cmd}".:ve:ver:version:ve[rsion]Print the version number of the editor. If thecompiler used understands "__DATE__" the compilationdateis mentioned. Otherwisea fixed release-dateisshown.The following lines contain information about whichfeatures were enabled when Vim was compiled. Whenthereisa preceding '+', the featureis included,when thereisa '-'itis excluded. To change this,you have to edit feature.h and recompile Vim.To check for this in an expression, seehas().Hereis an overview of the features.The first column shows the smallest version in whichthey are included:Ttiny (always)NnormalHhugemmanually enabled or depends on other features- never, feature was removed (none) system dependentThus ifa featureis marked with "N",itis includedin the normal and huge versions of Vim.+feature-list+aclACL support included+ARPAmiga only: ARP support includedH+arabicArabic language supportN+autochdir support'autochdir' optionT+autocmd:autocmd, automatic commands. Always enabled since8.0.1564H+autoservername Automatically enableclientserverm+balloon_evalballoon-eval support in the GUI. Included whencompiling with supportedGUI (Motif, GTK, GUI) andeither Netbeans/Sun Workshop integration or+evalfeature.H+balloon_eval_termballoon-eval support in the terminal,'balloonevalterm'N+browse:browse commandT++builtin_terms maximal terminals builtinbuiltin-terms Alwaysenabled since 9.0.0280N+byte_offset support for 'o' flag in'statusline' option, "go"and ":goto" commands.m+channel inter process communicationchannelT+cindent'cindent',C indenting; Always enabledN+clientserverUnix and Win32: Remote invocationclientserver+clipboardclipboard support compiled-in+clipboard_workingclipboard support compiled-in and workingT+cmdline_compl command line completioncmdline-completionT+cmdline_hist command linehistorycmdline-historyT+cmdline_info'showcmd' and'ruler'; Always enabled since9.0.0747T+cmdwincmdline-window support; Always enabled since 9.0.0657T+comments'comments' supportN+conceal "conceal" support, seeconceal:syn-conceal etc.N+cryptvencryption supportencryptionH+cscopecscope supportT+cursorbind'cursorbind' supportm+cursorshapetermcap-cursor-shape supportm+debug Compiled for debugging.N+dialog_gui Support for:confirm withGUI dialog.N+dialog_con Support for:confirm with console dialog.N+dialog_con_gui Support for:confirm withGUI and console dialog.N+diffvimdiff and'diff'N+digraphsdigraphsE196+directxWin32GUI only: DirectX and'renderoptions'+dnd Support for DnD into the "~registerquote_~.H+emacs_tagsemacs-tags filesN+evalexpression evaluationeval.txtT+ex_extra always on now, used to be for Vim's extraEx commandsN+extra_search'hlsearch' and'incsearch' options.-+farsi Removed:farsi languageT+file_in_pathgf,CTRL-W_f and<cfile> Always enabled since9.0.265N+find_in_path include file searches:[I,:isearch,CTRL-W_CTRL-I,:checkpath, etc.N+foldingfolding+footergui-footer+forkUnix only:fork shell commandsT+float Floating point support Always enabled since 9.0.0491N+gettext message translationsmulti-lang-+GUI_AthenaUnix only: AthenaGUI+GUI_neXtawUnix only: neXtawGUI+GUI_GTKUnix only:GTK+GUI+GUI_MotifUnix only:MotifGUI+GUI_PhotonQNX only: PhotonGUIm+hangul_input Hangul input supporthangul+iconv Compiled with theiconv() function+iconv/dyn Likewiseiconv-dynamic/dynT+insert_expandinsert_expandInsert mode completionm+ipv6 Support for IPv6 networkingchannelm+jobstarting and stopping jobsjobT+jumplistjumplist; Always enabled since 8.2.3795H+keymap'keymap'N+lambdalambda andclosureH+langmap'langmap'N+libcalllibcall()N+linebreak'linebreak','breakat' and'showbreak'T+lispindent'lisp'T+listcmds Vim commands for thelist ofbuffersbuffer-hiddenand argumentlist:argdeleteT+localmap Support for mappings local toa buffer:map-localm+luaLua interfacem+lua/dynLua interface/dynN+menu:menuN+mksession:mksessionT+modify_fnamefilename-modifiersT+mouse Mouse handlingmouse-usingN+mouseshape'mouseshape'N+mouse_decUnix only: Decterminal mouse handlingdec-mouseN+mouse_gpmUnix only: Linux console mouse handlinggpm-mousem+mouse_gpm/dyn Sameas+mouse_gpm with optional library dependency/dynN+mouse_jsbterm JSB mouse handlingjsbterm-mouseN+mouse_nettermUnix only: netterm mouse handlingnetterm-mouseN+mouse_ptermQNX only: pterm mouse handlingqnx-terminalN+mouse_sysmouseUnix only: *BSD console mouse handlingsysmouseN+mouse_sgrUnix only: sgr mouse handlingsgr-mouseN+mouse_urxvtUnix only: urxvt mouse handlingurxvt-mouseN+mouse_xtermUnix only: xterm mouse handlingxterm-mouseT+multi_byteUnicode support, 16 and 32 bit charactersmultibyte+multi_byte_imeWin32 inputmethod formultibyte charsmultibyte-imeN+multi_lang non-English language supportmulti-langm+mzscheme Mzscheme interfacemzschemem+mzscheme/dyn Mzscheme interfacemzscheme-dynamic/dynm+netbeans_intgnetbeansT+num64 64-bitNumber supportNumberAlways enabled since 8.2.0271, usev:numbersize tocheck the actual size ofa Number.m+oleWin32GUI only:ole-interfaceN+packages LoadingpackagesT+path_extra Up/downwards search in'path' and'tags' Alwaysenabled since 9.0.0270m+perlPerl interfaceperlm+perl/dynPerl interfaceperl-dynamic/dynN+persistent_undo Persistentundoundo-persistenceN+popupwin Popupwindowspopup-window+postscript:hardcopy writesa PostScript fileN+printer:hardcopy commandH+profile:profile commandm+pythonPython 2 interfacepythonm+python/dynPython 2 interfacepython-dynamic/dynm+python3Python 3 interfacepythonm+python3/dynPython 3 interfacepython-dynamic/dynm+python3/dyn-stablePython 3 interfacepython-dynamicpython-stable/dynN+quickfix:make andquickfix commandsN+reltimereltime() function,'hlsearch'/'incsearch' timeout,'redrawtime' optionH+rightleft Right to left typing'rightleft'm+rubyRuby interfacerubym+ruby/dynRuby interfaceruby-dynamic/dynT+scrollbind'scrollbind'N+signs:signT+smartindent'smartindent'H+sodium compiled with libsodium for betterencryption supportH+soundsound_playevent(),sound_playfile() functions, etc.N+spellspell checking support, seespellN+startuptime--startuptime argumentN+statusline Options'statusline','rulerformat' and specialformats of'titlestring' and'iconstring'-+sun_workshop Removed:workshopN+syntaxSyntax highlightingsyntax+system()Unix only: opposite of+forkH+tabpanel Support fortabpanelT+tag_binary binary searching intags filetag-binary-search-+tag_old_static Removed;method for statictagstag-old-static-+tag_any_white Removed; was to allow any whitespace intags filesm+tclTcl interfacetclm+tcl/dynTcl interfacetcl-dynamic/dynm+terminal Support forterminalwindowterminal+terminfo usesterminfo instead oftermcapN+termresponse support fort_RV andv:termresponseN+termguicolors 24-bit color in xterm-compatible terminals supportT+textobjectstext-objects selection. Always enabled since 9.0.0222.N+textproptext-properties+tgetent non-Unix only: able to use externaltermcapN+timers thetimer_start() functionT+title Setting thewindow'title' and'icon'; Always enabledN+toolbargui-toolbarT+user_commands User-defined commands.user-commandsAlways enabled since 8.1.1210.H+vartabs Variable-widthtab stops.'vartabstop'T+vertsplit Vertically splitwindows:vsplit; Always enabledsince 8.0.1118.T+vim9scriptVim9scriptN+viminfo'viminfo'T+virtualedit'virtualedit' Always enabled since 8.1.826.T+visualVisual modeVisual-mode Always enabled since 7.4.200.T+visualextra extraVisual mode commandsblockwise-operatorsT+vreplacegR andgr+vtp onMS-Windows console: support for'termguicolors'N+waylandUnix only: support for the Wayland protocol.N+wayland_clipboardUnix only: support for Wayland selections/clipboard.T+wildignore'wildignore' Always enabled since 9.0.0278T+wildmenu'wildmenu' Always enabled since 9.0.0279T+windows more than one window; Always enabled since 8.0.1118.m+writebackup'writebackup'is default onm+ximX inputmethodxim+xfontsetXfontset supportxfontsetN+xattr compiled with extended attribute support (Linux only)+xpm pixmap supportm+xpm_w32Win32GUI only: pixmap supportw32-xpm-support+xsmp XSMP (X session management) support+xsmp_interact interactive XSMP (X session management) supportN+xterm_clipboardUnix only: xtermclipboard handlingm+xterm_save save and restore xterm screenxterm-screensN+X11Unix only: can restorewindow titleX11/dynE370E448To some of the features "/dyn"is added when thefeatureis only available when the related library canbe dynamically loaded.:ve[rsion]{nr}Is now ignored. This was previously used to check theversion number ofa.vimrc file. It was removed,because you can now use the ":if" command forversion-dependent behavior.:redi:redir:redi[r][!]>{file}Redirectmessages to file{file}. Themessages whichare the output of commands are written to that file,until redirection ends. Themessages are also stillshown on the screen. When [!]is included, anexisting fileis overwritten. When [!]is omitted,and{file} exists, this command fails.Only one ":redir" can be activeata time. Calls to":redir" will close any active redirection beforestarting redirection to the new target. For recursiveuse check outexecute().To stop themessages and commands from being echoed tothe screen,put the commands ina function and callitwith ":silent call Function()".An alternativeis to use the'verbosefile' option,this can be used in combination with ":redir".:redi[r]>>{file}Redirectmessages to file{file}. Append if{file}already exists.:redi[r] @{a-zA-Z}:redi[r] @{a-zA-Z}>Redirectmessages toregister{a-z}. Append to thecontents of theregister if its nameis givenuppercase{A-Z}. The ">" after theregister nameisoptional.:redi[r] @{a-z}>>Appendmessages toregister{a-z}.:redi[r]@*>:redi[r] @+>Redirectmessages to the selection or clipboard. Forbackward compatibility, the ">" after theregistername can be omitted. Seequotestar andquoteplus.:redi[r]@*>>:redi[r] @+>>Appendmessages to the selection or clipboard.:redi[r]@">Redirectmessages to the unnamed register. Forbackward compatibility, the ">" after theregistername can be omitted.:redi[r]@">>Appendmessages to the unnamed register.E1092:redi[r] =>{var}Redirectmessages toa variable.In legacy script: If the variable doesn't exist, thenitis created. If the variable exists, thenitisinitialized to an empty string. After the redirectionstarts, if the variableis removed or locked or thevariable typeis changed, then further command outputmessages will cause errors. When usinga localvariable (l:var ina function ors:var ina script)and another:redir causes the current one to end,the scope might be different and the assignment fails.InVim9 script: the variablemust have been declaredasa string.The variable will remain empty until redirection ends.Onlystringvariables can be used.To get the output of one command theexecute()function can be used instead of redirection.:redi[r] =>>{var}Appendmessages to an existing variable. Onlystringvariables can be used.E1185:redi[r] ENDEnd redirecting messages.:filt:filter:filt[er][!]{pattern}{command}:filt[er][!] /{pattern}/{command}Restrict the output of{command} to lines matchingwith{pattern}. For example, tolist only xml files::filter /\.xml$/ oldfilesIf the [!]is given, restrict the output of{command}to lines thatdo NOT match{pattern}.{pattern}isa Vim search pattern. Instead of enclosingit in/ any non-ID character (see'isident') can beused, so longasit does not appear in{pattern}.Without the enclosing character thepattern cannotinclude thebar character.'ignorecase'is not used.Thepatternis matched against the relevant part ofthe output, not necessarily the whole line. Only somecommands support filtering, tryit out to check ifitworks. Some of the commands that support filtering::#-filter whole line:clist-filter by file name or module name:command-filter by command name:files-filter by file name:highlight-filter by highlight group:history-filter byhistory commands:jumps-filter by file name:let-filter by variable name:list-filter whole line:llist-filter by file name or module name:marks-filter by text in the current file, or file name for other files:oldfiles-filter by file name:registers-filter byregister contents (does not work multi-line):set-filter by option nameOnly normalmessages are filtered, errormessages arenot.:sil:silent:silent!:sil[ent][!]{command}Execute{command} silently.Normalmessages will notbe given or added to the message history.When [!]is added, errormessages will also beskipped, and commands and mappings will not be abortedwhen an erroris detected.v:errmsgis still set.When [!]is not used, an error message will causefurthermessages to be displayed normally.Redirection, started with:redir, will continueasusual, although there might be small differences.This will allow redirecting the output ofa commandwithout seeingit on the screen. Example: :redir >/tmp/foobar :silent g/Aap/p :redir ENDTo executeaNormal mode command silently, use the:normal command. For example, to search forastring without messages: :silent exe "normal /path\<CR>"":silent!"is useful to executea command that mayfail, but the failureis to be ignored. Example: :let v:errmsg = "" :silent! /^begin :if v:errmsg != "" : ... pattern was not found":silent" will also avoid thehit-enter prompt. Whenusing this for an external command, this may cause thescreen to be messed up. UseCTRL-L to cleanit upthen.":silent menu..." definesa menu that will not echoaCommand-line command. The command will still producemessages though. Use ":silent" in the command itselfto avoid that: ":silent menu ....:silent command".:uns:unsilent:uns[ilent]{command}Execute{command} not silently. Only makesadifference when:silent was used to get to thiscommand.Use this for givinga message even when:silent wasused. In this example:silentis used to avoid themessage about reading the file and:unsilent to beable tolist the first line of each file.:silent argdo unsilent echo expand('%') .. ": " .. getline(1):verb:verbose:[count]verb[ose]{command}Execute{command} with'verbose' set to[count]. If[count]is omitted oneis used. ":0verbose" can beused to set'verbose' to zero.The additional use of ":silent" makesmessagesgenerated but not displayed.The combination of ":silent" and ":verbose" can beused to generatemessages and check them withv:statusmsg and friends. For example::let v:statusmsg = "":silent verbose runtime foobar.vim:if v:statusmsg != "": " foobar.vim could not be found:endifWhen concatenating another command, the ":verbose"only applies to the first one::4verbose set verbose | set verbose verbose=4 verbose=0For loggingverbosemessages ina file use the'verbosefile' option.:verbose-cmdWhen'verbose'is non-zero, listing the value ofa Vim option ora key map oran abbreviation ora user-defined function ora command ora highlight groupor anautocommand will also display whereit was last defined. Ifit wasdefined manually then there will be no "Last set" message. Whenit wasdefined while executinga function, user command or autocommand, thescript inwhichit was definedis reported.{not available when compiled without the |+eval| feature}KKRuna program to lookup the keyword under thecursor. The name of the programis given with the'keywordprg' (kp) option (defaultis "man"). Thekeywordis formed of letters, numbers and thecharacters in'iskeyword'. The keyword under orright of the cursoris used. The same can be donewith the command:!{program} {keyword}Thereis an example ofa program to use in the toolsdirectory of Vim. Itis called "ref" and doesasimple spelling check.Special cases:- If'keywordprg' begins with ":"itis invokedasa VimEx command with[count].- If'keywordprg'is empty, the ":help" commandis used. It'sa good idea to include more characters in'iskeyword' then, to be able to find more help.- When'keywordprg'is equal to "man" or starts with ":",a[count] before "K"is inserted after keywordprg and before the keyword. For example, using "2K" while the cursoris on "mkdir", results in:!man 2 mkdir- When'keywordprg'is equal to "man-s",acount before "K"is inserted after the "-s". If thereis no count, the "-s"is removed.v_K{Visual}KLike "K", but use the visually highlighted text forthe keyword. Only works when the highlighted textisnot more than one line.[N]gsgs:sl:sleep:[N]sl[eep] [N][m]Do nothing for [N] seconds. When [m]is included,sleep for [N] milliseconds. Thecount for "gs" alwaysuses seconds. The defaultis one second. :sleep "sleep for one second :5sleep "sleep for five seconds :sleep 100m "sleep for 100 milliseconds 10gs "sleep for ten secondsCan be interrupted withCTRL-C (CTRL-Break onMS-Windows). "gs" stands for "goto sleep".While sleeping the cursoris positioned in the text,ifata visible position.Queuedmessages andtimers(+timers) are processedduring the sleepas well.:sl!:sleep!:[N]sl[eep]! [N][m]Sameas above, but hide the cursor.:xrestore:xr:xr[estore][display]Reinitializes the connection to theX11 server. Usefulafter theX server restarts, e.g. when running Vim forlong time inside screen/tmux and connecting fromdifferent machines.[display] should be in the format of the $DISPLAYenvironment variable (e.g. "localhost:10.0")If[display]isomitted, thenit reinitializes theconnection to theX11 server using the same valueaswas used for the previous execution of this command.If the value was never specified, thenit uses thevalue of $DISPLAY environment variableasit was whenVim was started. This will also updatev:clipmethod.{only available when compiled with the+xterm_clipboard feature}:clipreset:clip:clip[reset]Attempts to choosea newmethod for accessing theclipboard, using the'clipmethod' option. Thisisuseful when the currentmethod has become unavailable,and you want to try using another method.{only available when compiled with the+clipboardfeature}g_CTRL-AgCTRL-AOnly when Vim was compiled with MEM_PROFILING defined(whichis very rare): print memory usage statistics.Only useful for debugging Vim.For incrementing inVisual mode seev_g_CTRL-A.==============================================================================2. Using Vim likeless or morelessIf you use theless or more program toviewa file, you don't getsyntaxhighlighting. Thus you would like to use Vim instead. You cando this byusing the shellscript "$VIMRUNTIME/macros/less.sh".This shellscript uses the Vimscript "$VIMRUNTIME/macros/less.vim". It setsup mappings to simulate the commands thatless supports. Otherwise, you canstill use the Vim commands.This isn't perfect. For example, when viewinga short file Vim will still usethe whole screen. Butit works well enough for most uses, and you getsyntaxhighlighting.The "h" key will give youa short overview of the available commands.If you want to setoptions differently when using less, define theLessInitFunc in your vimrc, for example:func LessInitFunc() set nocursorcolumn nocursorlineendfunc vim:tw=78:ts=8:noet:ft=help:norl: