📄 windows.txt
字号:
25. :srewind 35. :sbrewind split + to first arg/buf26. :slast 36. :sblast split + to last arg/buf27. :sall 37: :sball edit all args/buffers 38. :sunhide edit all loaded buffers 39. :[N]sbmod [N] split + to Nth modified buf40. :args list of arguments41. :buffers list of buffersThe meaning of [N] depends on the command: [N] is number of buffers to go forward/backward on ?2, ?3, and ?4 [N] is an argument number, defaulting to current argument, for 1 and 21 [N] is a buffer number, defaulting to current buffer, for 11 and 31 [N] is a count for 19 and 39Note: ":next" is an exception, because it must accept a list of file namesfor compatibility with Vi.The argument list and multiple windows--------------------------------------The current position in the argument list can be different for each window.Remember that when doing ":e file", the position in the argument list staysthe same, but you are not editing the file at 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 argument list are added to the buffer list. Thus, youcan also get to them with the buffer list commands, like ":bnext".:[N]al[l][!] [N] *:al* *:all* *:sal* *:sall*:[N]sal[l][!] [N] Rearrange the screen to open one window for each argument. All other windows are closed. When a count is given, this is the maximum number of windows to open. When the 'hidden' option is set, all buffers in closed windows become hidden. When 'hidden' is not set, and the 'autowrite' option is set, modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is given, then they become hidden. But modified buffers are never abandoned, so changes cannot get lost. Buf/Win Enter/Leave autocommands are not executed for the new windows here, that's only done when they are really entered.:[N]sa[rgument][!] [N] *:sa* *:sargument* Short for ":split | argument [N]": split window and go to Nth argument. But when there is no such argument, the window is not split.:[N]sn[ext][!] [file ..] *:sn* *:snext* Short for ":split | [N]next": split window and go to Nth next argument. But when there is no next file, the window is not split.:[N]spr[evious][!] [N] *:spr* *:sprevious*:[N]sN[ext][!] [N] *:sN* *:sNext* Short for ":split | [N]Next": split window and go to Nth previous argument. But when there is no previous file, the window is not split. *:sr* *:srewind*:sr[ewind][!] Short for ":split | rewind": split window and go to first argument. But when there is no argument list, the window is not split. *:sla* *:slast*:sla[st][!] Short for ":split | last": split window and go to last argument. But when there is no argument list, the window is not split.==============================================================================10. Tag or file name under the cursor *window-tag* *:sta* *:stag*:sta[g][!] [tagname] Does ":tag[!] [tagname]" and splits the window for the found tag. See also |:tag|.CTRL-W ] *CTRL-W_]* *CTRL-W_CTRL-]*CTRL-W CTRL-] Split current window in two. Use identifier under cursor as a tag and jump to it in the new upper window. Make new window N high. *CTRL-W_g]*CTRL-W g ] Split current window in two. Use identifier under cursor as a tag and perform ":tselect" on it in the new upper window. Make new window N high. *CTRL-W_g_CTRL-]*CTRL-W g CTRL-] Split current window in two. Use identifier under cursor as a tag and perform ":tjump" on it in the new upper window. Make new window N high. *:pta* *:ptag*:pta[g][!] [tagname] Does ":tag[!] [tagname]" and shows the found tag in a "Preview" window without changing the current buffer or cursor position. If a "Preview" window already exists, it is re-used (like a help window is). If a new one is opened, 'previewheight' is used for the height of the window. See also |:tag|. Example: *CursorHold-example*> au! CursorHold *.[ch] nested exe "ptag " . expand("<cword>") This will cause a ":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 other autocommands be executed, so that syntax highlighting works in the preview window. Also see |CursorHold|. Note: this isn't perfect, you will get error messages when the cursor rests on a word that isn't a tag.CTRL-W z *CTRL-W_z*CTRL-W CTRL-Z *CTRL-W_CTRL-Z* *:pc* *:pclose*:pc[lose][!] Close any "Preview" windows currently open. When the 'hidden' option is set, or when the buffer was changed and the [!] is used, the buffer becomes hidden (unless there is another window editing it). The command fails if any "Preview" buffer cannot be closed. See also |:close|. *:pp* *:ppop*:[count]pp[op][!] Does ":[count]pop[!]" in the preview window. See |:pop| and |:ptag|. {not in Vi}CTRL-W } *CTRL-W_}* Use identifier under cursor as a tag and perform a :ptag on it. Make the new Preview window (if required) N high. If N is not given, 'previewheight' is used.CTRL-W g } *CTRL-W_g}* Use identifier under cursor as a tag and perform a :ptjump on it. Make the new Preview window (if required) N high. If N is not given, 'previewheight' is used.CTRL-W f *CTRL-W_f* *CTRL-W_CTRL-F*CTRL-W CTRL-F Split current window in two. Edit file name under cursor. Like ":split ]f", but window isn't split if the file does not exist. Uses the 'path' variable as a list of directory names where to look for the file. Also the path for current file is used to search for the file name. If the name is a hypertext link that looks like "type://machine/path", only "/path" is used. If a count is given, the count'th matching file is edited. Not available when the |+file_in_path| feature was disabled at compile time.Also see |CTRL-W_CTRL-I|: open window for an included file that includesthe keyword under the cursor.==============================================================================11. Using hidden buffers *buffer-hidden*A hidden buffer is not displayed in a window, but is still loaded into memory.This makes it possible to jump from file to file, without the need to read orwrite the file every time you get another buffer in a window. *:buffer-!*If the option 'hidden' ('hid') is set, abandoned buffers are kept for allcommands that start editing another file: ":edit", ":next", ":tag", etc. Thecommands that move through the buffer list sometimes make the current bufferhidden although the 'hidden' option is not set. This happens when a buffer ismodified, but is forced (with '!') to be removed from a window, and'autowrite' is off or the buffer can't be written.You can make a hidden buffer not hidden by starting to edit it with anycommand. Or by deleting it with the ":bdelete" command. *hidden-quit*When you try to quit Vim while there is a 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 without writing (":q!").Be careful: there may be more hidden, modified buffers!:files *:files*:buffers *:buffers* *:ls*:ls Show all buffers. Example:> 1 #h "/test/text" line 1> 2 - "asdf" line 0> 3 % + "version.c" line 1 Each buffer has a unique number. That number will not change, so you can always go to a specific buffer with ":buffer N" or "N CTRL-^", where N is the buffer number. '-' indicates a buffer that is not loaded. 'h' indicates a hidden buffer: It is loaded, but currently not displayed in a window. '%' indicates the buffer in the current window. '#' indicates the alternate buffer for ":e #" or CTRL-^. '+' indicates a modified buffer. *:bad* *:badd*:bad[d] [+lnum] {fname} Add file name {fname} to the buffer list, without loading it. If "lnum" is specified, the cursor will be positioned at that line when the buffer is first entered. Note that other commands after the + will be ignored.:[N]bd[elete] *:bd* *:bdel* *:bdelete*:bd[elete] [N] Unload buffer [N] (default: current buffer) and delete it from the buffer list. If the buffer was changed, this fails. The file remains unaffected. Any windows for this buffer are closed. If buffer [N] is the current buffer, another buffer will be displayed instead. This is the most recent entry in the jump list that points into a loaded buffer.:[N]bdelete!:bdelete! [N] Unload buffer [N] (default: current buffer) and delete it from the buffer list. If the buffer was changed the changes are lost. The file remains unaffected. Any windows for this buffer are closed. If buffer [N] is the current buffer, another buffer will be displayed instead. This is the most recent entry in the jump list that points into a loaded buffer.:bdelete[!] {bufname} Like ":bdelete[!] [N]", but buffer given by name. Note that a buffer whose name is a number cannot be referenced by that name; use the buffer number instead. Insert a backslash before a space in a buffer name.:N,Mbdelete[!] do ":bdelete[!]" for all buffers in the range N to M (inclusive).:bdelete[!] N1 N2 ... do ":bdelete[!]" for buffer N1, N2, etc. The arguments can be buffer numbers or buffer names (but not buffer names that are a number). Insert a backslash before a space in a buffer name.:[N]bun[load] *:bun* *:bunload*:bun[load] [N] Unload buffer [N] (default: current buffer). The memory allocated for this buffer will be freed. The buffer remains in the buffer list. If the buffer was changed, this fails. Any windows for this buffer are closed. If buffer [N] is the current buffer, another buffer will be displayed instead. This is the most recent entry in the jump list that points into a loaded buffer.:[N]bunload!:bunload! [N] Unload buffer [N] (default: current buffer). The memory allocated for this buffer will be freed. The buffer remains in the buffer list. If the buffer was changed, the changes are lost. Any windows for this buffer are closed. If buffer [N] is the current buffer, another buffer will be displayed instead. This is the most recent entry in the jump list that points into a loaded buffer.:bunload[!] {bufname} Like ":bunload[!] [N]", but buffer given by name. Note that a buffer whose name is a number cannot be referenced by that name; use the buffer number instead. Insert a backslash before a space in a buffer name.:N,Mbunload[!] do ":bunload[!]" for all buffers in the range N to M (inclusive).:bunload[!] N1 N2 ... do ":bunload[!]" for buffer N1, N2, etc. The arguments can be buffer numbers or buffer names (but not buffer names that are a number). Insert a backslash before a space in a buffer name.:[N]b[uffer][!] [N] *:b* *:bu* *:buffer* Edit buffer [N] from the buffer list. If [N] is not given, the current buffer remains being edited. See |:buffer-!| for [!].:[N]b[uffer][!] {filename} Edit buffer for {filename} from the buffer list. See |:buffer-!| for [!].:[N]sb[uffer] [N] *:sb* *:sbuffer* Split window and edit buffer [N] from the buffer list. If [N] is not given, the current buffer is edited. Respects the "useopen" setting of 'switchbuf' when splitting.:[N]sb[uffer] {filename} Split window and edit buffer for {filename} from the buffer list. *:bn* *:bnext*:[N]bn[ext][!] [N] Go to [N]th next buffer in buffer list. [N] defaults to one. Wraps around the end of the buffer list. See |:buffer-!| for [!]. If you are in a help buffer, this takes you to the next help buffer (if there is one). Similarly, if you are in a normal (non-help) buffer, this takes you to the next normal buffer. This is so that if you have invoked help, it doesn't get in the way when you're browsing code/text buffers. The next three commands also work like this. *:sbn* *:sbnext*:[N]sbn[ext] [N] Split window and go to [N]th next buffer in buffer list. Wraps around the end of the buffer list. Uses 'switchbuf':[N]bN[ext][!] [N] *:bN* *:bNext* *:bp* *:bprevious*:[N]bp[revious][!] [N] Go to [N]th previous buffer in buffer list. [N] defaults to one. Wraps around the start of the buffer list. See |:buffer-!| for [!] and 'switchbuf'.:[N]sbN[ext] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious*:[N]sbp[revious] [N] Split window and go to [N]th previous buffer in buffer list.+ Wraps around the start of the buffer list. Uses 'switchbuf'. *:br* *:brewind*:br[ewind][!] Go to first buffer in buffer list. See |:buffer-!| for [!]. *:sbr* *:sbrewind*:sbr[ewind] Split window and go to first buffer in buffer list. Respects 'switchbuf' option. *:bl* *:blast*:bl[ast][!] Go to last buffer in buffer list. See |:buffer-!| for [!]. *:sbl* *:sblast*:sbl[ast] Split window and go to last buffer in buffer list. Respects 'switchbuf' option.:[N]bm[odified][!] [N] *:bm* *:bmodified* Go to [N]th next modified buffer in buffer list.:[N]sbm[odified] [N] *:sbm* *:sbmodified* Split window and go to [N]th next modified buffer in buffer list. Respects 'switchbuf' option.:[N]unh[ide] [N] *:unh* *:unhide* *:sun* *:sunhide*:[N]sun[hide] [N] Rearrange the screen to open one window for each loaded buffer in the buffer list. When a count is given, this is the maximum number of windows to open.:[N]ba[ll] [N] *:ba* *:ball* *:sba* *:sball*:[N]sba[ll] [N] Rearrange the screen to open one window for each buffer in the buffer list. When a count is given, this is the maximum number of windows to open. Buf/Win Enter/Leave autocommands are not executed for the new windows here, that's only done when they are really entered.Note: All the commands above that start editing another buffer, keep the'readonly' flag as it was. This differs from the ":edit" command, which setsthe 'readonly' flag each time the file is read. vim:ts=8:sw=8:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -