windows.txt ForVim version 9.2. Last change: 2026 Feb 14VIM REFERENCE MANUAL by Bram MoolenaarEditing with multiplewindows and buffers.windowsbuffersThe commands which have been added to use multiplewindows andbuffers areexplained here. Additionally, there are explanations for commands that workdifferently when used in combination with more than one window.The basics are explained in chapter 7 and 8 of the user manualusr_07.txtusr_08.txt.1. Introductionwindows-intro2. Starting Vimwindows-starting3. Opening and closingawindowopening-window4. Moving cursor to otherwindowswindow-move-cursor5. Movingwindows aroundwindow-moving6. Window resizingwindow-resize7. Argument and bufferlist commandsbuffer-list8. Doa command in allbuffers orwindowslist-repeat9. Tag or file name under the cursorwindow-tag10. The previewwindowpreview-window11. Using hiddenbuffersbuffer-hidden12.Special kinds ofbuffersspecial-buffers{not able to use multiplewindows when the+windows feature was disabledatcompile time}==============================================================================1. Introductionwindows-introwindowSummary:A bufferis the in-memory text ofa file.Awindowisa viewport ona buffer.Atab pageisa collection of windows.Awindowisa viewport ontoa buffer. You can use multiplewindows on onebuffer, or severalwindows on different buffers.A bufferisa file loaded into memory for editing. The original file remainsunchanged until you write the buffer to the file.A buffer can be in one of three states:active-bufferactive: The bufferis displayed ina window. If thereisa file for this buffer,it has been read into the buffer. The buffer may have been modified since then and thus be different from the file.hidden-bufferhidden: The bufferis not displayed. If thereisa file for this buffer,it has been read into the buffer. Otherwise it's the sameas an active buffer, you just can't see it.inactive-bufferinactive: The bufferis not displayed and does not contain anything. Options for the buffer are remembered if the file was once loaded. It can contain marks from theviminfo file. But the buffer doesn't contain text.Ina table:statedisplayedloaded":buffers"in windowshowsactive yes yes 'a'hidden no yes 'h'inactive no no''buffer-reuseEach buffer hasaunique number and the number will not change withina Vimsession. Thebufnr() andbufname()functions can be used to convertbetweena buffer name and the buffer number. Thereis one exception: ifa newempty bufferis created anditis not modified, the buffer will be re-usedwhen loading another file into that buffer. This also means the buffer numberwill not change.The main Vimwindow can hold several split windows. There are alsotab pagestab-page, each of which can hold multiple windows.window-IDwinidwindowidEachwindow hasaunique identifier called thewindow ID. This identifierwill not change withina Vim session. Thewin_getid() andwin_id2tabwin()functions can be used to convert between the window/tab number and theidentifier. Thereis also thewindow number, which may change wheneverwindows are opened or closed, seewinnr().Thewindow numberis only valid in one specific tab. Thewindow IDis validacross tabs. For mostfunctions that takeawindow ID orawindow number, thewindow number only applies to the current tab, while thewindow ID can refertoawindow in any tab.==============================================================================2. Starting Vimwindows-startingBy default, Vim starts with one window, just like Vi.The "-o" and "-O" arguments to Vim can be used to openawindow for each filein the argument list. The "-o" argument will split thewindows horizontally;the "-O" argument will split thewindows vertically. If both "-o" and "-O"are given, the last one encountered will be used to determine the splitorientation. For example, this will open three windows, split horizontally:vim -o file1 file2 file3"-oN", whereNisa decimal number, opensNwindows split horizontally. Ifthere are more file names than windows, onlyNwindows are opened and somefilesdo not geta window. If there are morewindows than file names, thelast fewwindows will be editing empty buffers. Similarly, "-ON" opensNwindows split vertically, with the same restrictions.If there are many file names, thewindows will become very small. You mightwant to set the'winheight' and/or'winwidth'options to createa workablesituation.Buf/Win Enter/Leaveautocommands are not executed when opening the newwindows and reading the files, that's only done when they are really entered.status-lineA status line will be used to separate windows. The'laststatus' option tellswhen the lastwindow also hasa status line:'laststatus'=0nevera status line'laststatus'= 1status line if thereis more than onewindow'laststatus'= 2alwaysa status lineYou can change the contents of the status line with the'statusline' option.This option can be local to the window, so that you can havea differentstatus line in each window.Normally, inversionis used to display the status line. This can be changedwith the 's' character in the'highlight' option. For example, "sb" setsittobold characters. If no highlightingis used for the status line("sn"),the '^' characteris used for the current window, and '=' for other windows.If the mouseis supported and enabled with the'mouse' option,a status linecan be dragged to resize windows.Note: If you expect your status line to be in reverse video andit isn't,check if the'highlight' option contains "si". In version 3.0, this meant toinvert the status line. Nowit should be "sr", reverse the status line,as"si" now stands for italic! Ifitalicis not available on your terminal, thestatus lineis inverted anyway; you will only see this problem on terminalsthat havetermcap codes for italics.filler-linesThe lines after the last buffer line inawindow are called filler lines. Bydefault, these lines start witha tilde (~) character. The "eob" item in the'fillchars' option can be used to change this character. By default, thesecharacters are highlightedas NonText(hl-NonText). The EndOfBufferhighlight group(hl-EndOfBuffer) can be used to change the highlighting ofthe filler characters.==============================================================================3. Opening and closingawindowopening-windowCTRL-WsCTRL-W_sCTRL-WSCTRL-W_SCTRL-WCTRL-SCTRL-W_CTRL-S:[N]sp[lit][++opt][+cmd]:sp:splitSplit currentwindow in two. The resultis two viewports onthe same file.Make the newwindowN high (defaultis to use half the heightof the current window). Reduces the currentwindow height tocreate room (and others, if the'equalalways' optionis set,'eadirection' isn't "hor", and one of themis higher than thecurrent or the new window).Note:CTRL-S does not work on all terminals and might blockfurther input, useCTRL-Q to get going again.Also see++opt and+cmd.E242E1159Be careful when splittingawindow in an autocommand,it maymess up thewindow layout if this happens while making otherwindow layout changes.:[N]sp[lit][++opt][+cmd]{file}:split_fLike:split but createa newwindow and start editing file{file} in it.This behaves almost likea ":split" first, and then an ":edit"command, but the alternate file name in the originalwindowisset to{file}.If[+cmd]is given, execute the command when the file has beenloaded+cmd.Also see++opt.Make newwindowN high (defaultis to use half the existingheight). Reduces the currentwindow height to create room(and others, if the'equalalways' optionis set).CTRL-WCTRL-VCTRL-W_CTRL-VCTRL-WvCTRL-W_v:[N]vs[plit][++opt][+cmd][file]:vs:vsplitLike:split, but split vertically. Thewindows will bespread out horizontally if1.a width was not specified,2.'equalalways'is set,3.'eadirection' isn't "ver", and4. one of the otherwindowsis wider than the current or new window.IfN was given make the newwindowN columns wide, ifpossible.Note: In other placesCTRL-Q does the sameasCTRL-V, but hereit doesn't!CTRL-WnCTRL-W_nCTRL-WCTRL-NCTRL-W_CTRL-N:[N]new[++opt][+cmd]:newCreatea newwindow and start editing an empty file in it.Make newwindowN high (defaultis to use half the existingheight). Reduces the currentwindow height to create room(and others, if the'equalalways' optionis set and'eadirection' isn't "hor").Also see++opt and+cmd.If'fileformats'is not empty, the first format given will beused for the new buffer. If'fileformats'is empty, the'fileformat' of the current bufferis used. This can beoverridden with the++opt argument.Autocommands are executed in this order:1.WinLeave for the currentwindow2.WinEnter for the newwindow3.BufLeave for the current buffer4.BufEnter for the new bufferThis behaves likea ":split" first, and then an ":enew"command.:[N]new[++opt][+cmd]{file}Like:split_f, createa newwindow and start editing{file}.:[N]vne[w][++opt][+cmd][file]:vne:vnewLike:new, but split vertically. If'equalalways'is setand'eadirection' isn't "ver" thewindows will be spread outhorizontally, unlessa width was specified.:[N]sv[iew][++opt][+cmd][file]:sv:sviewsplitviewSameas ":split", but set'readonly' option for this buffer.:[N]sf[ind][++opt][+cmd]{file}:sf:sfi:sfindsplitfindSameas ":split", but search for{file} in'path' like in:find. Doesn't split if{file}is not found.CTRL-WCTRL-^CTRL-W_CTRL-^CTRL-W_^CTRL-W^Split the currentwindow in two and edit the alternate file.WhenacountNis given, split the currentwindow and editbuffer N. Similar to ":sp#" and ":sp #N", butit allows theother buffer to be unnamed. This command matches the behaviorofCTRL-^, except thatit splitsawindow first.CTRL-W_:CTRL-W:Does the sameas typing:- entera command line. Useful inaterminal window, where all Vim commandsmust be preceded withCTRL-W or'termwinkey'.Note that the'splitbelow' and'splitright'options influence wherea newwindow will appear.E36Creatingawindow will fail if thereis not enough room. Everywindow needsat least one screen line and column, sometimes more. Options'winminheight'and'winminwidth' are relevant.:vert:vertical:vert[ical]{cmd}Execute{cmd}. Ifit containsa command that splitsa window,it will be split vertically. For `vertical wincmd =`windowswill be equalized only vertically.Doesn't work for:execute and:normal.:hor:horizontal:hor[izontal]{cmd}Execute{cmd}. Currently only makesa difference for`horizontal wincmd =`, which will equalizewindows onlyhorizontally.:lefta[bove]{cmd}:lefta:leftabove:abo[veleft]{cmd}:abo:aboveleftExecute{cmd}. Ifit containsa command that splitsa window,it will be opened left (vertical split) or above (horizontalsplit) the current window. Overrules'splitbelow' and'splitright'.Doesn't work for:execute and:normal.:rightb[elow]{cmd}:rightb:rightbelow:bel[owright]{cmd}:bel:belowrightExecute{cmd}. Ifit containsa command that splitsa window,it will be opened right (vertical split) or below (horizontalsplit) the current window. Overrules'splitbelow' and'splitright'.Doesn't work for:execute and:normal.:topleftE442:to[pleft]{cmd}Execute{cmd}. Ifit containsa command that splitsa window,it will appearat the top and occupy the full width of the Vimwindow. When the splitis vertical thewindow appearsat thefar left and occupies the full height of the Vim window.Doesn't work for:execute and:normal.:bo:botright:bo[tright]{cmd}Execute{cmd}. Ifit containsa command that splitsa window,it will appearat the bottom and occupy the full width of theVim window. When the splitis vertical thewindow appearsatthe far right and occupies the full height of the Vim window.Doesn't work for:execute and:normal.These command modifiers can be combined to makea vertically splitwindowoccupy the full height. Example::vertical topleft split tagsOpensa vertically split, full-heightwindow on the "tags" fileat the farleft of the Vim window.Closingawindow----------------:q[uit]:{count}q[uit]:count_quitCTRL-WqCTRL-W_qCTRL-WCTRL-QCTRL-W_CTRL-QWithout{count}: Quit the current window. If{count}isgiven quit the{count} window.edit-windowWhen quitting the last editwindow (not countinghelp orpreview windows), exit Vim.When'hidden'is set, and thereis only onewindow for thecurrent buffer,it becomes hidden. When'hidden'is not set,and thereis only onewindow for the current buffer, and thebuffer was changed, the command fails.(Note:CTRL-Q does not work on all terminals).If[count]is greater than the lastwindow number the lastwindow will be closed: :1quit " quit the first window :$quit " quit the last window :9quit " quit the last window " if there are fewer than 9 windows opened :-quit " quit the previous window :+quit " quit the next window :+2quit " quit the second next windowWhen closingahelp window, and thisis not the only window,Vim will try to restore the previouswindow layout, see:helpclose.:q[uit]!:{count}q[uit]!Without{count}: Quit the current window. If{count}isgiven quit the{count} window.If this was the lastwindow fora buffer, any changes to thatbuffer are lost. When quitting the lastwindow (not countinghelp windows), exit Vim. The contents of the buffer are lost,even when'hidden'is set.:clo[se][!]:{count}clo[se][!]CTRL-WcCTRL-W_c:clo:closeWithout{count}: Close the current window. If{count}isgiven close the{count} window.When the'hidden' optionis set, or when the buffer waschanged and the [!]is used, the buffer becomes hidden (unlessthereis anotherwindow editing it).When thereis only oneedit-window in the currenttab pageand thereis anothertab page, this closes the currenttabpage.tab-page.This command fails when:E444- Thereis only onewindow on the screen.- When'hidden'is not set, [!]is not used, the buffer has changes, and thereis no otherwindow on this buffer.Changes to the buffer are not written and won't get lost, sothisisa "safe" command.CTRL-WCTRL-CCTRL-W_CTRL-CYou might have expected thatCTRL-WCTRL-C closes the currentwindow, but that does not work, because theCTRL-C cancels thecommand.:hide:hid[e]:{count}hid[e]Without{count}: Quit the current window, unlessitis thelastwindow on the screen.If{count}is given quit the{count} window.The buffer becomes hidden (unless thereis anotherwindoweditingit or'bufhidden'is "unload", "delete" or "wipe").If thewindowis the last one in the currenttab page thetabpageis closed.tab-pageThe value of'hidden'is irrelevant for this command. Changesto the buffer are not written and won't get lost, so thisisa"safe" command.:hid[e]{cmd}Execute{cmd} with'hidden' set. The previous value of'hidden'is restored after{cmd} has been executed.Example: :hide edit MakefileThis will edit "Makefile", and hide the current buffer ifithas any changes.:on[ly][!]:{count}on[ly][!]CTRL-WoCTRL-W_oE445CTRL-WCTRL-OCTRL-W_CTRL-O:on:onlyMake the currentwindow the only one on the screen. All otherwindows are closed. For{count} see the:quit commandabove:count_quit.When the'hidden' optionis set, allbuffers in closedwindowsbecome hidden.When'hidden'is not set, and the'autowrite' optionis set,modifiedbuffers are written. Otherwise,windows that havebuffers that are modified are not removed, unless the [!]isgiven, then they become hidden. But modifiedbuffers arenever abandoned, so changes cannot get lost.==============================================================================4. Moving cursor to otherwindowswindow-move-cursorCTRL-W<Down>CTRL-W_<Down>CTRL-WCTRL-JCTRL-W_CTRL-JCTRL-W_jCTRL-WjMove cursor to Nthwindow below current one. Uses the cursorposition to select between alternatives.CTRL-W<Up>CTRL-W_<Up>CTRL-WCTRL-KCTRL-W_CTRL-KCTRL-W_kCTRL-WkMove cursor to Nthwindow above current one. Uses the cursorposition to select between alternatives.CTRL-W<Left>CTRL-W_<Left>CTRL-WCTRL-HCTRL-W_CTRL-HCTRL-W<BS>CTRL-W_<BS>CTRL-W_hCTRL-WhMove cursor to Nthwindow left of current one. Uses thecursor position to select between alternatives.CTRL-W<Right>CTRL-W_<Right>CTRL-WCTRL-LCTRL-W_CTRL-LCTRL-W_lCTRL-WlMove cursor to Nthwindow right of current one. Uses thecursor position to select between alternatives.CTRL-WwCTRL-W_wCTRL-W_CTRL-WCTRL-WCTRL-WWithout count: move cursor towindow below/right of thecurrent one. If thereis nowindow below or right,go totop-left window.With count:go to Nthwindow (windows are numbered fromtop-left to bottom-right). To obtain thewindow number seebufwinnr() andwinnr(). WhenNis larger than the numberofwindowsgo to the last window.CTRL-W_WCTRL-WWWithout count: move cursor towindow above/left of currentone. If thereis nowindow above or left,go to bottom-rightwindow. With count:go to Nth window, like withCTRL-W w.CTRL-WtCTRL-W_tCTRL-W_CTRL-TCTRL-WCTRL-TMove cursor to top-left window.CTRL-WbCTRL-W_bCTRL-W_CTRL-BCTRL-WCTRL-BMove cursor to bottom-right window.CTRL-WpCTRL-W_pCTRL-W_CTRL-PCTRL-WCTRL-PGo to previous (last accessed) window.CTRL-W_PE441CTRL-WPGo to preview window. When thereis no previewwindow thisisan error.{not available when compiled without the |+quickfix| feature}IfVisual modeis active and the newwindowis not for the same buffer, theVisual modeis ended. If thewindowis on the same buffer, the cursorpositionis set to keep the sameVisual area selected.:winc:wincmdThese commands can also be executed with ":wincmd"::[count]winc[md]{arg}Like executingCTRL-W[count]{arg}. Example::wincmd jMoves to thewindow below the current one.This commandis useful whenaNormal mode cannot be used (fortheCursorHoldautocommand event). Or whenaNormal modecommandis inconvenient.Thecount can also beawindow number. Example::exe nr .. "wincmd w"This goes towindow "nr".Note: AllCTRL-W commands can also be executed with:wincmd, for thoseplaces whereaNormal mode command can't be used oris inconvenient (e.g.ina browser-based terminal).==============================================================================5. Movingwindows aroundwindow-movingCTRL-WrCTRL-W_rCTRL-W_CTRL-RE443CTRL-WCTRL-RRotatewindows downwards/rightwards. The firstwindow becomesthe second one, the second one becomes the third one, etc.The lastwindow becomes the first window. The cursor remainsin the same window.This only works within the row or column ofwindows that thecurrentwindowis in.CTRL-W_RCTRL-WRRotatewindows upwards/leftwards. The secondwindow becomesthe first one, the third one becomes the second one, etc. Thefirstwindow becomes the last window. The cursor remains inthe same window.This only works within the row or column ofwindows that thecurrentwindowis in.CTRL-WxCTRL-W_xCTRL-W_CTRL-XCTRL-WCTRL-XWithout count: Exchange currentwindow with next one. Ifthereis no next window, exchange with previous window.With count: Exchange currentwindow with Nthwindow (firstwindowis 1). The cursorisput in the other window.When vertical and horizontalwindow splits are mixed, theexchangeis only done in the row or column ofwindows that thecurrentwindowis in.The following commands can be used to change thewindow layout. For example,when there are two vertically split windows,CTRL-WK will change that inhorizontally split windows.CTRL-WH doesit the other way around.CTRL-W_KCTRL-WKMove the currentwindow to beat the very top, using the fullwidth of the screen. This works like `:topleft split`, exceptitis applied to the currentwindow and no newwindowiscreated.CTRL-W_JCTRL-WJMove the currentwindow to beat the very bottom, using thefull width of the screen. This works like `:botright split`,exceptitis applied to the currentwindow and no newwindowis created.CTRL-W_HCTRL-WHMove the currentwindow to beat the far left, using thefull height of the screen. This works like`:vert topleft split`, exceptitis applied to the currentwindow and no newwindowis created.CTRL-W_LCTRL-WLMove the currentwindow to beat the far right, using the fullheight of the screen. This works like `:vert botright split`,exceptitis applied to the currentwindow and no newwindowis created.CTRL-W_TCTRL-WTMove the currentwindow toa newtab page. This fails ifthereis only onewindow in the currenttab page.This works like `:tab split`, except the previouswindowisclosed.Whenacountis specified the newtab page will be openedbefore thetab page with this index. Otherwiseit comes afterthe currenttab page.==============================================================================6. Window resizingwindow-resizeCTRL-W_=CTRL-W=Make allwindows (almost) equally high and wide, but use'winheight' and'winwidth' for the current window.Windows with'winfixheight' set keep their height andwindowswith'winfixwidth' set keep their width.To equalize only vertically (makewindow equally high) use`vertical wincmd =`.To equalize only horizontally (makewindow equally wide) use`horizontal wincmd =`.:res[ize]-N:res:resizeCTRL-W_-CTRL-W-Decrease currentwindow height byN (default 1).If used after:vertical: decrease width by N.:res[ize] +NCTRL-W_+CTRL-W+Increase currentwindow height byN (default 1).If used after:vertical: increase width by N.:res[ize] [N]CTRL-WCTRL-_CTRL-W_CTRL-_CTRL-W__CTRL-W_Set currentwindow height toN (default: highest possible).:{winnr}res[ize] [+-]NLike:resize above, but apply the size towindow{winnr}instead of the current window.z{nr}<CR>Set currentwindow height to{nr}.CTRL-W_<CTRL-W<Decrease currentwindow width byN (default 1).CTRL-W_>CTRL-W>Increase currentwindow width byN (default 1).:vert[ical] res[ize] [N]:vertical-resizeCTRL-W_barCTRL-W |Set currentwindow width toN (default: widest possible).You can also resizeawindow by dragginga status line up or down with themouse. Or by dragginga vertical separator line left or right. This onlyworks if the version of Vim thatis being used supports the mouse and the'mouse' option has been set to enable it.The option'winheight' ('wh')is used to set the minimalwindow height of thecurrent window. This optionis used each time anotherwindow becomes thecurrent window. If the optionis '0',itis disabled. Set'winheight' toavery large value, e.g., '9999', to make the currentwindow always fill allavailable space. Setit toa reasonable value, e.g., '10', to make editing inthe currentwindow comfortable.The equivalent'winwidth' ('wiw') optionis used to set the minimal width ofthe current window.When the option'equalalways' ('ea')is set, all thewindows are automaticallymade the same size after splitting or closinga window. If you don't set thisoption, splittingawindow will reduce the size of the currentwindow andleave the otherwindows the same. When closinga window, the extra lines aregiven to thewindow above it.The'eadirection' optionlimits the direction in which the'equalalways'optionis applied. The default "both" resizes in both directions. When thevalueis "ver" only the heights ofwindows are equalized. Use this when youhave manually resizeda vertically splitwindow and want to keep this width.Likewise, "hor" causes only the widths ofwindows to be equalized.The option'cmdheight' ('ch')is used to set the height of the command-line.If you are annoyed by thehit-enter prompt for long messages, set thisoption to 2 or 3.If thereis only one window, resizing thatwindow will also change the commandline height. If there are several windows, resizing the currentwindow willalso change the height of thewindow belowit (and sometimes thewindow aboveit).The minimal height and width ofawindowis set with'winminheight' and'winminwidth'. These are hard values,awindow will never become smaller.WinScrolled and WinResized autocommandswin-scrolled-resizedIf you want to get notified of changes inwindow sizes, theWinResizedautocommand event can be used.If you want to get notified of text inwindowsscrolling vertically orhorizontally, theWinScrolledautocommand event can be used. This will alsotrigger inwindow size changes.Exception: the events will not be triggered when the text scrolls for'incsearch'.WinResized-eventTheWinResized eventis triggered after updating the display, severalwindows may have changed size then.Alist of the IDs ofwindows that changedsince last timeis provided in the v:event.windows variable, for example:[1003, 1006]WinScrolled-eventTheWinScrolled eventis triggered afterWinResized, and also ifawindowwas scrolled. That can be vertically (the textat the top of thewindowchanged) or horizontally (when'wrap'is off or when the first displayed partof the first line changes).Note thatWinScrolled will trigger many moretimes thanWinResized,it may slow down editinga bit.The information provided byWinScrolledisa dictionary for eachwindow thathas changes, using thewindow IDas the key, anda totalcount of the changeswith the key "all". Example value forv:event(Vim9 syntax):{ all: {width: 0, height: 2, leftcol: 0, skipcol: 0, topline: 1, topfill: 0}, 1003: {width: 0, height: -1, leftcol: 0, skipcol: 0, topline: 0, topfill: 0}, 1006: {width: 0, height: 1, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},}Note that the "all" entry has the absolute values of the individualwindowsaccumulated.If you need more information about what changed, or you want to "debounce" theevents (not handle every event to avoid doing too much work), you may want touse thewinlayout() andgetwininfo() functions.WinScrolled andWinResizeddo not trigger when the firstautocommandisadded, only after the first scroll or resize. They may trigger when switchingto anothertab page.The commands executed are expected to not causewindow size or scroll changes.If this happens anyway, the event will trigger again very soon. In otherwords: Just before triggering the event, the current sizes and scrollpositions are stored and used to decide whether there wasa change.E1312Itis not allowed to change thewindow layout here (split, close or movewindows).==============================================================================7. Argument and bufferlist commandsbuffer-list args list buffer list meaning1. :[N]argument [N]11. :[N]buffer [N]to arg/bufN2. :[N]next [file ..]12. :[N]bnext [N]to Nth next arg/buf3. :[N]Next [N]13. :[N]bNext [N]to Nth previous arg/buf4. :[N]previous[N]14. :[N]bprevious [N]to Nth previous arg/buf5.:rewind/:first15.:brewind/:bfirstto first arg/buf6.:last16.:blastto last arg/buf7.:all17.:balledit all args/buffers18.:unhideedit all loadedbuffers19. :[N]bmod [N]to Nth modified buf split & args list split & buffer list meaning21. :[N]sargument [N] 31. :[N]sbuffer [N]split+ to arg/bufN22. :[N]snext [file ..] 32. :[N]sbnext [N] split+ to Nth next arg/buf23. :[N]sNext [N] 33. :[N]sbNext [N] split+ to Nth previous arg/buf24. :[N]sprevious [N] 34. :[N]sbprevious [N] split+ to Nth previous arg/buf25.:srewind/:sfirst35.:sbrewind/:sbfirst split+ to first arg/buf26.:slast36.:sblastsplit+ to last arg/buf27.:sall37.:sballedit all args/buffers38.:sunhideedit all loadedbuffers39. :[N]sbmod [N]split+ to Nth modified buf40.:argslist of arguments41.:bufferslist ofbuffersThe meaning of [N] depends on the command: [N]is the number ofbuffers togo forward/backward on 2/12/22/32, 3/13/23/33, and 4/14/24/34 [N]is an argument number, defaulting to current argument, for 1 and 21 [N]isa buffer number, defaulting to current buffer, for 11 and 31 [N]isacount for 19 and 39Note: ":next"is an exception, becauseitmust acceptalist of file namesfor compatibility with Vi.The argumentlist and multiplewindows--------------------------------------The current position in the argumentlist can be different for each window.Remember that when doing ":e file", the position in the argumentlist staysthe same, but you are not editing the fileat that position. To indicatethis, the file message (and the title, if you have one) shows"(file (N) of M)", where "(N)"is the current position in the file list, and"M" the number of files in the file list.All the entries in the argumentlist are added to the buffer list. Thus, youcan also get to them with the bufferlist commands, like ":bnext".:[N]al[l][!] [N]:al:all:sal:sall:[N]sal[l][!] [N]Rearrange the screen to open onewindow for each argument.All otherwindows are closed. Whenacountis given, thisisthe maximum number ofwindows to open.With the:tab modifier openatab page for each argument.When there are more arguments than'tabpagemax' further onesbecome splitwindows in the lasttab page.When the'hidden' optionis set, allbuffers in closedwindowsbecome hidden.When'hidden'is not set, and the'autowrite' optionis set,modifiedbuffers are written. Otherwise,windows that havebuffers that are modified are not removed, unless the [!]isgiven, then they become hidden. But modifiedbuffers arenever abandoned, so changes cannot get lost.[N]is the maximum number ofwindows to open.'winheight'alsolimits the number ofwindows opened ('winwidth' if:vertical was prepended).Buf/Win Enter/Leaveautocommands are not executed for the newwindows here, that's only done when they are really entered.Ifautocommands change thewindow layout while this commandisbusy an error will be given.E249:[N]sa[rgument][!][++opt][+cmd] [N]:sa:sargumentShort for ":split | argument [N]": splitwindow andgo to Nthargument. But when thereis no such argument, thewindowisnot split. Also see++opt and+cmd.:[N]sn[ext][!][++opt][+cmd] [file ..]:sn:snextShort for ":split | [N]next": splitwindow andgo to Nth nextargument. But when thereis no next file, thewindowis notsplit. Also see++opt and+cmd.:[N]spr[evious][!][++opt][+cmd] [N]:spr:sprevious:[N]sN[ext][!][++opt][+cmd] [N]:sN:sNextShort for ":split | [N]Next": splitwindow andgo to Nthprevious argument. But when thereis no previous file, thewindowis not split. Also see++opt and+cmd.:sre:srewind:sre[wind][!][++opt][+cmd]Short for ":split | rewind": splitwindow andgo to firstargument. But when thereis no argument list, thewindowisnot split. Also see++opt and+cmd.:sfir:sfirst:sfir[st][++opt][+cmd]Sameas ":srewind".:sla:slast:sla[st][!][++opt][+cmd]Short for ":split | last": splitwindow andgo to lastargument. But when thereis no argument list, thewindowisnot split. Also see++opt and+cmd.:dr:drop:dr[op][++opt][+cmd]{file} ..Edit the first{file} ina window.- If the fileis already open inawindow change to that window.- If the fileis not open inawindow edit the file in the current window. If the current buffer can't beabandoned, thewindowis split first.- Windows that are not in the argumentlist or are not full width will be closed if possible.Theargument-listis set, like with the:next command.The purpose of this commandis thatit can be used fromaprogram that wants Vim to edit another file, e.g.,a debugger.When using the:tab modifier each argumentis opened inatab page. The lastwindowis used if it's empty.Also see++opt and+cmd.==============================================================================8. Doa command in allbuffers orwindowslist-repeat:windo:[range]windo{cmd}Execute{cmd} in eachwindow or if[range]is givenonly inwindows for which thewindow number lies inthe[range]. It works like doing this:CTRL-W t:{cmd}CTRL-W w:{cmd}etc.This only operates in the currenttab page.When an erroris detected on one window, furtherwindows will not be visited.The lastwindow (or where an error occurred) becomesthe current window.{cmd} can contain'|' to concatenate several commands.{cmd}must not open or closewindows or reorder them.Also see:tabdo,:argdo,:bufdo,:cdo,:ldo,:cfdo and:lfdo:bufdo:[range]bufdo[!]{cmd}Execute{cmd} in each buffer in the bufferlist or if[range]is given only forbuffers for which theirbuffer numberis in the[range]. It works like doingthis::bfirst:{cmd}:bnext:{cmd}etc.When the current file can't beabandoned and the [!]is not present, the command fails.When an erroris detected on one buffer, furtherbuffers will not be visited.Unlistedbuffers are skipped.The last buffer (or where an error occurred) becomesthe current buffer.{cmd} can contain'|' to concatenate several commands.{cmd}must not deletebuffers or addbuffers to thebuffer list.Note: While this commandis executing, theSyntaxautocommand eventis disabled by addingit to'eventignore'. This considerably speeds up editingeach buffer.Also see:tabdo,:argdo,:windo,:cdo,:ldo,:cfdo and:lfdoExamples::windo set nolist foldcolumn=0 | normal! znThis resets the'list' option and disablesfolding in all windows.:bufdo set fileencoding= | updateThis resets the'fileencoding' in each buffer and writesit if this changedthe buffer. The resultis that allbuffers will use the'encoding' encoding(if conversion succeeds).==============================================================================9. Tag or file name under the cursorwindow-tag:sta:stag:sta[g][!][tagname]Does ":tag[!][tagname]" and splits thewindow for the foundtag. Refer to'switchbuf' to jump toatag ina verticallysplitwindow ora newtab page. See also:tag.CTRL-W]CTRL-W_]CTRL-W_CTRL-]CTRL-WCTRL-]Split currentwindow in two. Use identifier under cursorasatag and jump toit in the new upper window.InVisual mode uses the Visually selected textasa tag.Make newwindowN high. Refer to'switchbuf' to jump toatagina vertically splitwindow ora newtab page.CTRL-W_g]CTRL-Wg]Split currentwindow in two. Use identifier under cursorasatag and perform ":tselect" onit in the new upper window.InVisual mode uses the Visually selected textasa tag.Make newwindowN high.CTRL-W_g_CTRL-]CTRL-WgCTRL-]Split currentwindow in two. Use identifier under cursorasatag and perform ":tjump" onit in the new upper window.InVisual mode uses the Visually selected textasa tag.Make newwindowN high.CTRL-WfCTRL-W_fCTRL-W_CTRL-FCTRL-WCTRL-FSplit currentwindow in two. Edit file name under cursor.Like ":splitgf", butwindow isn't split if the file does notexist.Uses the'path' variableasalist of directory names where tolook for the file. Also the path for current fileisused to search for the file name.If the nameisa hypertext link that looks like"type://machine/path", only "/path"is used.Ifacountis given, the count'th matching fileis edited.CTRL-WFCTRL-W_FSplit currentwindow in two. Edit file name under cursor andjump to the line number following the file name. SeegF fordetails on how the line numberis obtained.CTRL-WgfCTRL-W_gfOpena newtab page and edit the file name under the cursor.Like "tab split" and "gf", but the newtab page isn't createdif the file does not exist.CTRL-WgFCTRL-W_gFOpena newtab page and edit the file name under the cursorand jump to the line number following the file name. Like"tab split" and "gF", but the newtab page isn't created ifthe file does not exist.CTRL-WgtCTRL-W_gtGo to nexttab page, sameasgt.CTRL-WgTCTRL-W_gTGo to previoustab page, sameasgT.Also seeCTRL-W_CTRL-I: openwindow for an included file that includesthe keyword under the cursor.==============================================================================10. The previewwindowpreview-windowThe previewwindowisa specialwindow to show (preview) another file. Itisnormallya smallwindow used to show an include file or definition ofafunction.{not available when compiled without the |+quickfix| feature}There can be only one previewwindow (pertab page). Itis created with oneof the commands below. The'previewheight' option can be set to specify theheight of the previewwindow when it's opened. The'previewwindow' optionisset in the previewwindow to be able to recognize it. The'winfixheight'optionis set to haveit keep the same height when opening/closing otherwindows.preview-popupAlternatively,apopupwindow can be used by setting the'previewpopup'option. When set,it overrules the'previewwindow' and'previewheight'settings. The optionisa comma-separatedlist of values:heightmaximum height of thepopupwidthmaximum width of thepopuphighlighthighlight group of thepopup (defaultis Pmenu)Example::set previewpopup=height:10,width:60A few peculiarities:- If the fileis ina buffer already,it will be re-used. This will allow for editing the file while it's visible in thepopup window.- NoATTENTIONdialog will be used, since you can't edit the file in thepopup window. However, if you later open the same buffer ina normal window, you may not notice it's edited elsewhere. And when then using ":edit" to trigger theATTENTION and responding "A" for Abort, the previewwindow will become empty.:pt:ptag:pt[ag][!][tagname]Does ":tag[!][tagname]" and shows the foundtag ina"Preview"window withoutchanging the current buffer or cursorposition. Ifa "Preview"window already exists,itis re-used(likeahelpwindow is). Ifa new oneis opened,'previewheight'is used for the height of the window. Seealso:tag.See below for an example.CursorHold-exampleSmall difference from:tag: When[tagname]is equal to thealready displayed tag, the position in the matchingtaglistis not reset. This makes theCursorHold example work aftera:ptnext.CTRL-WzCTRL-W_zCTRL-WCTRL-ZCTRL-W_CTRL-Z:pc:pclose:pc[lose][!]Close any "Preview"window currently open. When the'hidden'optionis set, or when the buffer was changed and the [!]isused, the buffer becomes hidden (unless thereis anotherwindow editing it). The command fails if any "Preview" buffercannot be closed. See also:close.:pp:ppop:[count]pp[op][!]Does ":[count]pop[!]" in the preview window. See:pop and:ptag.CTRL-W}CTRL-W_}Use identifier under cursorasatag and performa:ptag onit. Make the new Previewwindow (if required)N high. IfNis not given,'previewheight'is used.CTRL-Wg}CTRL-W_g}Use identifier under cursorasatag and performa:ptjump onit. Make the new Previewwindow (if required)N high. IfNis not given,'previewheight'is used.:pb:pbuffer:[N]pb[uffer][!][+cmd] [N]Edit buffer [N] from the bufferlist in the preview window.If [N]is not given, the current buffer remains being edited.See:buffer-! for [!]. This will also edita buffer thatisnot in the buffer list, without setting the'buflisted' flag.Thenotation with singlequotes does not work here,`:pbuffer 12'345'` uses 12'345'asa buffer name.Also see+cmd.:ped:pedit:ped[it][!][++opt][+cmd]{file}Edit{file} in the preview window. The previewwindowisopened like with:ptag. The currentwindow and cursorposition isn't changed. Useful example::pedit +/fputc /usr/include/stdio.hAlso see++opt and+cmd.:ps:psearch:[range]ps[earch][!][count] [/]pattern[/]Works like:ijump but shows the found match in the previewwindow. The previewwindowis opened like with:ptag. Thecurrentwindow and cursor position isn't changed. Usefulexample::psearch popenLike with the:ptag command, you can use this toautomatically show information about theword under thecursor. Thisisless clever than using:ptag, but you don'tneedatags file andit will also find matches in systeminclude files. Example: :au! CursorHold *.[ch] ++nested exe "silent! psearch " .. expand("<cword>")Warning: This can be slow.ExampleCursorHold-example :au! CursorHold *.[ch] ++nested exe "silent! ptag " .. expand("<cword>")This will causea ":ptag" to be executed for the keyword under the cursor,when the cursor hasn't moved for the time set with'updatetime'. The "nested"makes otherautocommands be executed, so thatsyntax highlighting works in thepreview window. The "silent!" avoids an error message when thetag could notbe found. Also seeCursorHold. To disable this again: :au! CursorHoldA nice additionis to highlight the found tag, avoid the ":ptag" when thereis noword under the cursor, anda few other things: :au! CursorHold *.[ch] ++nested call PreviewWord() :func PreviewWord() : if &previewwindow" don't do this in the preview window : return : endif : let w = expand("<cword>")" get the word under cursor : if w =~ '\a'" if the word contains a letter : : " Delete any existing highlight before showing another tag : silent! wincmd P" jump to preview window : if &previewwindow" if we really get there... : match none" delete existing highlight : wincmd p" back to old window : endif : : " Try displaying a matching tag for the word under the cursor : try : exe "ptag " .. w : catch : return : endtry : : silent! wincmd P" jump to preview window : if &previewwindow" if we really get there... : if has("folding") : silent! .foldopen" don't want a closed fold : endif : call search("$", "b")" to end of previous line : let w = substitute(w, '\\', '\\\\', "") : call search('\<\V' .. w .. '\>')" position cursor on match : " Add a match highlight to the word at this position : hi previewWord term=bold ctermbg=green guibg=green : exe 'match previewWord "\%' .. line(".") .. 'l\%' .. col(".") .. 'c\k*"' : wincmd p" back to old window : endif : endif :endfun==============================================================================11. Using hiddenbuffersbuffer-hiddenA hidden bufferis not displayed ina window, butis still loaded into memory.This makesit possible to jump from file to file, without the need to read orwrite the file every time you get another buffer ina window.:buffer-!If the option'hidden' ('hid')is set, abandonedbuffers are kept for allcommands that start editing another file: ":edit", ":next", ":tag", etc. Thecommands that move through the bufferlist sometimes make the current bufferhidden although the'hidden' optionis not set. This happens whena bufferismodified, butis forced (with '!') to be removed froma window, and'autowrite'is off or the buffer can't be written.You can makea hidden buffer not hidden bystarting to editit with anycommand, or bydeletingit with the ":bdelete" command.The'hidden'is global,itis used for all buffers. The'bufhidden' optioncan be used to make an exception fora specific buffer. It can take thesevalues:<empty>Use the value of'hidden'.hideHide this buffer, also when'hidden'is not set.unloadDon't hide but unload this buffer, also when'hidden'is set.deleteDelete the buffer.hidden-quitWhen you try to quit Vim while thereisa hidden, modified buffer, you willget an error message and Vim will make that buffer the current buffer. Youcan then decide to write this buffer(":wq") or quit withoutwriting(":q!").Be careful: there may be more hidden, modified buffers!A buffer can also be unlisted. This meansit exists, butitis not in thelist of buffers.unlisted-buffer:files[!][flags]:files:buffers[!][flags]:buffers:ls:ls[!][flags]Show all buffers. Example:1 #h "/test/text"line 12u "asdf"line 03 %a + "version.c"line 1When the [!]is included thelist will show unlistedbuffers(the term "unlisted"isa bit confusing then...).Each buffer hasaunique number. That number will not change,thus you can alwaysgo toa specific buffer with ":bufferN"or "NCTRL-^", whereNis the buffer number.For the file name these special values are used:"[Prompt]"prompt-buffer"[Popup]"buffer ofapopup-window"[Scratch]"'buftype'is "nofile""[No Name]"no file name specifiedForaterminal-window buffer the statusis used.Indicators (chars in the same column are mutually exclusive):uan unlisted buffer (only displayed when [!]is used)unlisted-buffer%the buffer in the currentwindow#the alternate buffer for ":e#" andCTRL-^aan active buffer:itis loaded and visibleha hidden buffer: Itis loaded, but currently not displayed inawindowhidden-buffer-a buffer with'modifiable' off=a readonly bufferRaterminal buffer witha runningjobFaterminal buffer witha finishedjob?aterminal buffer withouta job: `:terminal NONE`+a modified bufferxa buffer with readerrors[flags] can bea combination of the following characters,which restrict thebuffers to be listed:+ modifiedbuffers-buffers with'modifiable' off= readonlybuffersa activebuffersu unlistedbuffers (overrides the "!")h hiddenbuffersxbuffers witha read error% current buffer# alternate bufferRterminalbuffers witha runningjobFterminalbuffers witha finishedjob?terminalbuffers withouta job: `:terminal NONE`t show time last used and sortbuffersCombining flags means they are "and"ed together, e.g.: h+ hiddenbuffers which are modified a+ activebuffers which are modifiedWhen using:filter thepatternis matched against thedisplayed buffer name, e.g.:filter /\.vim/ ls:bad:badd:bad[d][+lnum]{fname}Add file name{fname} to the buffer list, without loading it,ifit wasn't listed yet. If the buffer was previouslydeleted, not wiped,it will be made listed again.If "lnum"is specified, the cursor will be positionedat thatline when the bufferis first entered.Note that othercommands after the+ will be ignored.:balt:balt [+lnum]{fname}Like:badd and also set the alternate file for the currentwindow to{fname}.:[N]bd[elete][!]:bd:bdel:bdeleteE516:bd[elete][!] [N]Unload buffer [N] (default: current buffer) and deleteit fromthe buffer list. If the buffer was changed, this fails,unless [!]is specified, in whichcase changes are lost.The file remains unaffected. Anywindows for this buffer areclosed. If buffer [N]is the current buffer, another bufferwill be displayed instead. Thisis the most recent entry inthe jumplist that points intoa loaded buffer.Actually, the buffer isn't completely deleted,itis removedfrom the bufferlistunlisted-buffer and option values,variables and mappings/abbreviations for the buffer arecleared. If [N]is the last listed buffer inawindow (i.e.,thereis no other listed buffer to switch to), the bufferisemptied instead of being unloaded. Thewindowis not closed,and the buffer may be reusedasa new bufferbuffer-reuse.This ensures everywindow always hasa valid buffer.Examples: :.,$-bdelete " delete buffers from the current one to " last but one :%bdelete " delete all buffers:bd[elete][!]{bufname}E93E94Like ":bdelete[!] [N]", but buffer given by name, see{bufname}.:bd[elete][!] N1 N2...Do ":bdelete[!]" for buffer N1, N2, etc. The arguments can bebuffer numbers or buffer names (but not buffer names that area number).Insertabackslash beforeaspace ina buffername.:N,Mbd[elete][!]Do ":bdelete[!]" for allbuffers in the rangeN toMinclusive.:[N]bw[ipeout][!]:bw:bwipe:bwipeoutE517:bw[ipeout][!]{bufname}:N,Mbw[ipeout][!]:bw[ipeout][!] N1 N2...Like:bdelete, but really delete the buffer. Everythingrelated to the bufferis lost. All marks in this bufferbecome invalid, option settings are lost, thejumplist andtagstack data will be purged, etc. Don't use thisunless you know what you are doing. Examples: :.+,$bwipeout " wipe out all buffers after the current " one :%bwipeout " wipe out all buffers:[N]bun[load][!]:bun:bunloadE515:bun[load][!] [N]Unload buffer [N] (default: current buffer). The memoryallocated for this buffer will be freed. The buffer remainsin the buffer list.If the buffer was changed, this fails, unless when [!]isspecified, in whichcase the changes are lost.Anywindows for this buffer are closed. If buffer [N]is thecurrent buffer, another buffer will be displayed instead.Thisis the most recent entry in the jumplist that pointsintoa loaded buffer.:bun[load][!]{bufname}Like ":bunload[!] [N]", but buffer given by name.Also see{bufname}.:N,Mbun[load][!]Do ":bunload[!]" for allbuffers in the rangeN toMinclusive.:bun[load][!] N1 N2...Do ":bunload[!]" for buffer N1, N2, etc. The arguments can bebuffer numbers or buffer names (but not buffer names that area number).Insertabackslash beforeaspace ina buffername.:[N]b[uffer][!][+cmd] [N]:b:bu:buf:bufferE86Edit buffer [N] from the buffer list. If [N]is not given,the current buffer remains being edited. See:buffer-! for[!]. This will also edita buffer thatis not in the bufferlist, without setting the'buflisted' flag.Thenotation with singlequotes does not work here,`:buf 12'345'` uses 12'345'asa buffer name.Also see+cmd.:[N]b[uffer][!][+cmd]{bufname}{bufname}Edit buffer for{bufname} from the buffer list.Apartialname also works, so longasitisunique in thelist ofbuffers.Note thata buffer whose nameisa number cannot be referencedby that name; use the buffer number instead. Sameistrue ifthe buffer name starts witha+,it will be interpretedasthe start ofa+cmd.Insertabackslash beforeaspace ina buffer name.See:buffer-! for [!].This will also edita buffer thatis not in the buffer list,without setting the'buflisted' flag.Also see+cmd.:[N]sb[uffer][+cmd] [N]:sb:sbufferSplitwindow and edit buffer [N] from the buffer list. If [N]is not given, the current bufferis edited. Respects the"useopen" setting of'switchbuf' when splitting. This willalso edita buffer thatis not in the buffer list, withoutsetting the'buflisted' flag.Also see+cmd.:[N]sb[uffer][+cmd]{bufname}Splitwindow and edit buffer for{bufname} from the bufferlist. This will also edita buffer thatis not in the bufferlist, without setting the'buflisted' flag.Note: If what you want todois split the buffer, makea copyunder another name, you candoit this way::w foobar | sp #Also see+cmd.:[N]bn[ext][!][+cmd] [N]:bn:bnextE87Go to [N]th next buffer in buffer list. [N] defaults to one.Wraps around theend of the buffer list.See:buffer-! for [!].Also see+cmd.If you are inahelp buffer, this takes you to the nexthelpbuffer (if thereis one). Similarly, if you are ina normal(non-help) buffer, this takes you to the next normal buffer.Thisis so that if you have invoked help,it doesn't get inthe way when you're browsing code/text buffers. The nextthree commands also work like this.:sbn:sbnext:[N]sbn[ext][+cmd] [N]Splitwindow andgo to [N]th next buffer in buffer list.Wraps around theend of the buffer list. Uses'switchbuf'Also see+cmd.:[N]bN[ext][!][+cmd] [N]:bN:bNext:bp:bpreviousE88:[N]bp[revious][!][+cmd] [N]Go to [N]th previous buffer in buffer list. [N] defaults toone. Wraps around the start of the buffer list.See:buffer-! for [!] and'switchbuf'.Also see+cmd.:[N]sbN[ext][+cmd] [N]:sbN:sbNext:sbp:sbprevious:[N]sbp[revious][+cmd] [N]Splitwindow andgo to [N]th previous buffer in buffer list.Wraps around the start of the buffer list.Uses'switchbuf'.Also see+cmd.:br[ewind][!][+cmd]:br:bre:brewindGo to first buffer in buffer list. If the bufferlistisempty,go to the first unlisted buffer.See:buffer-! for [!].:bf[irst][+cmd]:bf:bfirstSameas:brewind.Also see+cmd.:sbr[ewind][+cmd]:sbr:sbrewindSplitwindow andgo to first buffer in buffer list. If thebufferlistis empty,go to the first unlisted buffer.Respects the'switchbuf' option.Also see+cmd.:sbf[irst][+cmd]:sbf:sbfirstSameas ":sbrewind".:bl[ast][!][+cmd]:bl:blastGo to last buffer in buffer list. If the bufferlistisempty,go to the last unlisted buffer.See:buffer-! for [!].:sbl[ast][+cmd]:sbl:sblastSplitwindow andgo to last buffer in buffer list. If thebufferlistis empty,go to the last unlisted buffer.Respects'switchbuf' option.:[N]bm[odified][!][+cmd] [N]:bm:bmodifiedE84Go to [N]th next modified buffer.Note: this command alsofinds unlisted buffers. If thereis no modified buffer thecommand fails.:[N]sbm[odified][+cmd] [N]:sbm:sbmodifiedSplitwindow andgo to [N]th next modified buffer.Respects'switchbuf' option.Note: this command also findsbuffers not in the buffer list.:[N]unh[ide] [N]:unh:unhide:sun:sunhide:[N]sun[hide] [N]Rearrange the screen to open onewindow for each loaded bufferin the buffer list. Whenacountis given, thisis themaximum number ofwindows to open.:[N]ba[ll] [N]:ba:ball:sba:sball:[N]sba[ll] [N]Rearrange the screen to open onewindow for each buffer inthe buffer list. Whenacountis given, thisis the maximumnumber ofwindows to open.'winheight' alsolimits the numberofwindows opened ('winwidth' if:vertical was prepended).Buf/Win Enter/Leaveautocommands are not executed for the newwindows here, that's only done when they are really entered.When the:tab modifieris used newwindows are opened inanew tab, up to'tabpagemax'.Note: All the commands above that start editing another buffer, keep the'readonly' flagasit was. This differs from the ":edit" command, which setsthe'readonly' flag each time the fileis read.==============================================================================12.Special kinds ofbuffersspecial-buffersInstead of containing the text ofa file,buffers can also be used for otherpurposes.A fewoptions can be set to change the behavior ofa buffer:'bufhidden'what happens when the bufferis no longer displayedina window.'buftype'what kind ofa buffer thisis'swapfile'whether the buffer will havea swap file'buflisted'buffer shows up in the bufferlistA few useful kinds ofa buffer:quickfixUsed to contain the errorlist or the location list. See:cwindow and:lwindow. This command sets the'buftype'option to "quickfix". You are not supposed to change this!'swapfile'is off.helpContainsahelp file. Will only be created with the:helpcommand. The flag that indicatesahelp bufferis internaland can't be changed. The'buflisted' option will be resetforahelp buffer.terminalAterminalwindow buffer, seeterminal. The contents cannotbe read or changed until thejob ends.directoryDisplays directory contents. Can be used bya file explorerplugin. The bufferis created with these settings::setlocal buftype=nowrite:setlocal bufhidden=delete:setlocal noswapfileThe buffer nameis the name of the directory andis adjustedwhen using the:cd command.scratch-bufferscratchContains text that can be discardedat any time. Itis keptwhen closing the window,itmust be deleted explicitly.Settings::setlocal buftype=nofile:setlocal bufhidden=hide:setlocal noswapfileThe buffer name can be used to identify the buffer, if yougiveita meaningful name.unlisted-bufferunlistedThe bufferis not in the buffer list. Itis not used fornormal editing, but to showahelp file, remembera file nameor marks. The ":bdelete" command will also set this option,thusit doesn't completely delete the buffer. Settings::setlocal nobuflisted vim:tw=78:ts=8:noet:ft=help:norl: