代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>usr_22 - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>
<body>
<header>
<div class="header">
<a href="http://vim-jp.org/">vim-jp</a>
/ <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
/ usr_22<br />
<a name="top"></a><h1>usr_22 - Vim Documentation</h1>
<a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
</div>
</header>
<nav>
<dl>
<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>
<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>
<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>
<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>
<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>
<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>
<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>
<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>
<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>
<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>
<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>
<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>
<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>
<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>
<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>
<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>
<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>
</dl>
</nav>
<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="usr_22.html" name="usr_22.txt">usr_22.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2016 Dec 13<br>
<br>
VIM USER MANUAL - by Bram Moolenaar<br>
<br>
Finding the file to edit<br>
<br>
<br>
Files can be found everywhere. So how do you find them? Vim offers various<br>
ways to browse the directory tree. There are commands to jump to a file that<br>
is mentioned in another. And Vim remembers which files have been edited<br>
before.<br>
<br>
<a class="Identifier" href="usr_22.html#22.1">22.1</a> The file browser<br>
<a class="Identifier" href="usr_22.html#22.2">22.2</a> The current directory<br>
<a class="Identifier" href="usr_22.html#22.3">22.3</a> Finding a file<br>
<a class="Identifier" href="usr_22.html#22.4">22.4</a> The buffer list<br>
<br>
Next chapter: <a class="Identifier" href="usr_23.html">usr_23.txt</a> Editing other files<br>
Previous chapter: <a class="Identifier" href="usr_21.html">usr_21.txt</a> Go away and come back<br>
Table of contents: <a class="Identifier" href="usr_toc.html">usr_toc.txt</a><br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_22.html#22.1" name="22.1">22.1</a> The file browser<br>
<br>
Vim has a plugin that makes it possible to edit a directory. Try this:<br>
<br>
<div class="helpExample"> :edit .</div>
<br>
Through the magic of autocommands and Vim scripts, the window will be filled<br>
with the contents of the directory. It looks like this:<br>
<br>
<span class="PreProc">" ============================================================================</span><br>
<span class="PreProc">" Netrw Directory Listing (netrw v109)</span><br>
<span class="PreProc">" Sorted by name</span><br>
<span class="PreProc">" Sort sequence: [\/]$,\.h$,\.c$,\.cpp$,*,\.info$,\.swp$,\.o$\.obj$,\.bak$</span><br>
<span class="PreProc">" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec</span><br>
<span class="PreProc">" ============================================================================</span><br>
<span class="PreProc">../</span><br>
<span class="PreProc">./</span><br>
<span class="PreProc">check/</span><br>
<span class="PreProc">Makefile</span><br>
<span class="PreProc">autocmd.txt</span><br>
<span class="PreProc">change.txt</span><br>
<span class="PreProc">eval.txt~</span><br>
<span class="PreProc">filetype.txt~</span><br>
<span class="PreProc">help.txt.info</span><br>
<br>
You can see these items:<br>
<br>
1. The name of the browsing tool and its version number<br>
2. The name of the browsing directory<br>
3. The method of sorting (may be by name, time, or size)<br>
4. How names are to be sorted (directories first, then *.h files,<br>
<span class="Statement"> </span>*.c files, etc)<br>
5. How to get help (use the <span class="Special"><F1></span> key), and an abbreviated listing<br>
of available commands<br>
6. A listing of files, including "../", which allows one to list<br>
the parent directory.<br>
<br>
If you have syntax highlighting enabled, the different parts are highlighted<br>
so as to make it easier to spot them.<br>
<br>
You can use Normal mode Vim commands to move around in the text. For example,<br>
move the cursor atop a file and press <span class="Special"><Enter></span>; you will then be editing that<br>
file. To go back to the browser use ":edit ." again, or use ":Explore".<br>
<span class="Special">CTRL-O</span> also works.<br>
<br>
Try using <span class="Special"><Enter></span> while the cursor is atop a directory name. The result is<br>
that the file browser moves into that directory and displays the items found<br>
there. Pressing <span class="Special"><Enter></span> on the first directory "../" moves you one level<br>
higher. Pressing "-" does the same thing, without the need to move to the<br>
"../" item first.<br>
<br>
You can press <span class="Special"><F1></span> to get help on the things you can do in the netrw file<br>
browser. This is what you get:<br>
<br>
<div class="helpExample"> 9. Directory Browsing netrw-browse netrw-dir netrw-list netrw-help </div>
<br>
<div class="helpExample"> MAPS netrw-maps <br>
<F1>.............Help.......................................|netrw-help|<br>
<cr>.............Browsing...................................|netrw-cr|<br>
<del>............Deleting Files or Directories..............|netrw-delete|<br>
-................Going Up...................................|netrw--|<br>
a................Hiding Files or Directories................|netrw-a|<br>
mb...............Bookmarking a Directory....................|netrw-mb|<br>
gb...............Changing to a Bookmarked Directory.........|netrw-gb|<br>
c................Make Browsing Directory The Current Dir....|netrw-c|<br>
d................Make A New Directory.......................|netrw-d|<br>
D................Deleting Files or Directories..............|netrw-D|<br>
<c-h>............Edit File/Directory Hiding List............|netrw-ctrl-h|<br>
i................Change Listing Style.......................|netrw-i|<br>
<c-l>............Refreshing the Listing.....................|netrw-ctrl-l|<br>
o................Browsing with a Horizontal Split...........|netrw-o|<br>
p................Use Preview Window.........................|netrw-p|<br>
P................Edit in Previous Window....................|netrw-p|<br>
q................Listing Bookmarks and History..............|netrw-qb|<br>
r................Reversing Sorting Order....................|netrw-r|</div>
(etc)<br>
<br>
The <span class="Special"><F1></span> key thus brings you to a netrw directory browsing contents help page.<br>
It's a regular help page; use the usual <a class="Identifier" href="tagsrch.html#CTRL-]">CTRL-]</a> to jump to tagged help items<br>
and <a class="Identifier" href="motion.html#CTRL-O">CTRL-O</a> to jump back.<br>
<br>
To select files for display and editing: (with the cursor is atop a filename)<br>
<br>
<span class="Special"><enter></span> Open the file in the current window. <a class="Identifier" href="pi_netrw.html#netrw-cr">netrw-cr</a><br>
o Horizontally split window and display file <a class="Identifier" href="pi_netrw.html#netrw-o">netrw-o</a><br>
v Vertically split window and display file <a class="Identifier" href="pi_netrw.html#netrw-v">netrw-v</a><br>
p Use the <a class="Identifier" href="windows.html#preview-window">preview-window</a> <a class="Identifier" href="pi_netrw.html#netrw-p">netrw-p</a><br>
P Edit in the previous window <a class="Identifier" href="pi_netrw.html#netrw-P">netrw-P</a><br>
t Open file in a new tab <a class="Identifier" href="pi_netrw.html#netrw-t">netrw-t</a><br>
<br>
The following normal-mode commands may be used to control the browser display:<br>
<br>
i Controls listing style (thin, long, wide, and tree).<br>
The long listing includes size and date information.<br>
s Repeatedly pressing s will change the way the files<br>
are sorted; one may sort on name, modification time,<br>
or size.<br>
r Reverse the sorting order.<br>
<br>
As a sampling of extra normal-mode commands:<br>
<br>
c Change Vim's notion of the current directory to be<br>
the same as the browser directory. (see<br>
<a class="Identifier" href="pi_netrw.html#g:netrw_keepdir">g:netrw_keepdir</a> to control this, too)<br>
R Rename the file or directory under the cursor; a<br>
prompt will be issued for the new name.<br>
D Delete the file or directory under the cursor; a<br>
confirmation request will be issued.<br>
mb gb Make bookmark/goto bookmark<br>
<br>
<br>
One may also use command mode; again, just a sampling:<br>
<br>
:Explore <span class="Special">[directory]</span> Browse specified/current directory<br>
:NetrwSettings A comprehensive list of your current netrw<br>
settings with help linkage.<br>
<br>
The netrw browser is not limited to just your local machine; one may use<br>
urls such as: (that trailing / is important)<br>
<br>
:Explore <span class="Constant">ftp://somehost/path/to/dir/</span><br>
:e scp://somehost/path/to/dir/<br>
<br>
See <a class="Identifier" href="pi_netrw.html#netrw-browse">netrw-browse</a> for more.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_22.html#22.2" name="22.2">22.2</a> The current directory<br>
<br>
Just like the shell, Vim has the concept of a current directory. Suppose you<br>
are in your home directory and want to edit several files in a directory<br>
"VeryLongFileName". You could do:<br>
<br>
<div class="helpExample"> :edit VeryLongFileName/file1.txt<br>
:edit VeryLongFileName/file2.txt<br>
:edit VeryLongFileName/file3.txt</div>
<br>
To avoid much of the typing, do this:<br>
<br>
<div class="helpExample"> :cd VeryLongFileName<br>
:edit file1.txt<br>
:edit file2.txt<br>
:edit file3.txt</div>
<br>
The ":cd" command changes the current directory. You can see what the current<br>
directory is with the ":pwd" command:<br>
<br>
<div class="helpExample"> :pwd<br>
/home/Bram/VeryLongFileName</div>
<br>
Vim remembers the last directory that you used. Use "cd -" to go back to it.<br>
Example:<br>
<br>
<div class="helpExample"> :pwd<br>
/home/Bram/VeryLongFileName<br>
:cd /etc<br>
:pwd<br>
/etc<br>
:cd -<br>
:pwd<br>
/home/Bram/VeryLongFileName<br>
:cd -<br>
:pwd<br>
/etc</div>
<br>
<br>
WINDOW LOCAL DIRECTORY<br>
<br>
When you split a window, both windows use the same current directory. When<br>
you want to edit a number of files somewhere else in the new window, you can<br>
make it use a different directory, without changing the current directory in<br>
the other window. This is called a local directory.<br>
<br>
<div class="helpExample"> :pwd<br>
/home/Bram/VeryLongFileName<br>
:split<br>
:lcd /etc<br>
:pwd<br>
/etc<br>
CTRL-W w<br>
:pwd<br>
/home/Bram/VeryLongFileName</div>
<br>
So long as no ":lcd" command has been used, all windows share the same current<br>
directory. Doing a ":cd" command in one window will also change the current<br>
directory of the other window.<br>
For a window where ":lcd" has been used a different current directory is<br>
remembered. Using ":cd" or ":lcd" in other windows will not change it.<br>
When using a ":cd" command in a window that uses a different current<br>
directory, it will go back to using the shared directory.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_22.html#22.3" name="22.3">22.3</a> Finding a file<br>
<br>
You are editing a C program that contains this line:<br>
<br>
<span class="PreProc">#include "inits.h"</span><br>
<br>
You want to see what is in that "inits.h" file. Move the cursor on the name<br>
of the file and type:<br>
<br>
<div class="helpExample"> gf</div>
<br>
Vim will find the file and edit it.<br>
What if the file is not in the current directory? Vim will use the <a class="Type" href="options.html#'path'">'path'</a><br>
option to find the file. This option is a list of directory names where to<br>
look for your file.<br>
Suppose you have your include files located in "c:/prog/include". This<br>
command will add it to the <a class="Type" href="options.html#'path'">'path'</a> option:<br>
<br>
<div class="helpExample"> :set path+=c:/prog/include</div>
<br>
This directory is an absolute path. No matter where you are, it will be the<br>
same place. What if you have located files in a subdirectory, below where the<br>
file is? Then you can specify a relative path name. This starts with a dot:<br>
<br>
<div class="helpExample"> :set path+=./proto</div>
<br>
This tells Vim to look in the directory "proto", below the directory where the<br>
file in which you use "gf" is. Thus using "gf" on "inits.h" will make Vim<br>
look for "proto/inits.h", starting in the directory of the file.<br>
Without the "./", thus "proto", Vim would look in the "proto" directory<br>
below the current directory. And the current directory might not be where the<br>
file that you are editing is located.<br>
<br>
The <a class="Type" href="options.html#'path'">'path'</a> option allows specifying the directories where to search for files<br>
in many more ways. See the help on the <a class="Type" href="options.html#'path'">'path'</a> option.<br>
The <a class="Type" href="options.html#'isfname'">'isfname'</a> option is used to decide which characters are included in the<br>
file name, and which ones are not (e.g., the " character in the example<br>
above).<br>
<br>
When you know the file name, but it's not to be found in the file, you can<br>
type it:<br>
<br>
<div class="helpExample"> :find inits.h</div>
<br>
Vim will then use the <a class="Type" href="options.html#'path'">'path'</a> option to try and locate the file. This is the<br>
same as the ":edit" command, except for the use of <a class="Type" href="options.html#'path'">'path'</a>.<br>
<br>
To open the found file in a new window use <span class="Special">CTRL-W</span> f instead of "gf", or use<br>
":sfind" instead of ":find".<br>
<br>
<br>
A nice way to directly start Vim to edit a file somewhere in the <a class="Type" href="options.html#'path'">'path'</a>:<br>
<br>
<div class="helpExample"> vim "+find stdio.h"</div>
<br>
This finds the file "stdio.h" in your value of <a class="Type" href="options.html#'path'">'path'</a>. The quotes are<br>
necessary to have one argument <a class="Identifier" href="starting.html#-+c">-+c</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<a class="Constant" href="usr_22.html#22.4" name="22.4">22.4</a> The buffer list<br>
<br>
The Vim editor uses the term buffer to describe a file being edited.<br>
Actually, a buffer is a copy of the file that you edit. When you finish<br>
changing the buffer, you write the contents of the buffer to the file.<br>
Buffers not only contain file contents, but also all the marks, settings, and<br>
other stuff that goes with it.<br>
<br>
<br>
HIDDEN BUFFERS<br>
<br>
Suppose you are editing the file one.txt and need to edit the file two.txt.<br>
You could simply use ":edit two.txt", but since you made changes to one.txt<br>
that won't work. You also don't want to write one.txt yet. Vim has a<br>
solution for you:<br>
<br>
<div class="helpExample"> :hide edit two.txt</div>
<br>
The buffer "one.txt" disappears from the screen, but Vim still knows that you<br>
are editing this buffer, so it keeps the modified text. This is called a<br>
hidden buffer: The buffer contains text, but you can't see it.<br>
The argument of ":hide" is another command. ":hide" makes that command<br>
behave as if the <a class="Type" href="options.html#'hidden'">'hidden'</a> option was set. You could also set this option<br>
yourself. The effect is that when any buffer is abandoned, it becomes hidden.<br>
Be careful! When you have hidden buffers with changes, don't exit Vim<br>
without making sure you have saved all the buffers.<br>
<br>
<br>
INACTIVE BUFFERS<br>
<br>
When a buffer has been used once, Vim remembers some information about it.<br>
When it is not displayed in a window and it is not hidden, it is still in the<br>
buffer list. This is called an inactive buffer. Overview:<br>
<br>
Active Appears in a window, text loaded.<br>
Hidden Not in a window, text loaded.<br>
Inactive Not in a window, no text loaded.<br>
<br>
The inactive buffers are remembered, because Vim keeps information about them,<br>
like marks. And remembering the file name is useful too, so that you can see<br>
which files you have edited. And edit them again.<br>
<br>
<br>
LISTING BUFFERS<br>
<br>
View the buffer list with this command:<br>
<br>
<div class="helpExample"> :buffers</div>
<br>
A command which does the same, is not so obvious to list buffers, but is much<br>
shorter to type:<br>
<br>
<div class="helpExample"> :ls</div>
<br>
The output could look like this:<br>
<br>
<span class="PreProc">1 #h "help.txt" line 62</span><br>
<span class="PreProc">2 %a + "usr_21.txt" line 1</span><br>
<span class="PreProc">3 "usr_toc.txt" line 1</span><br>
<br>
The first column contains the buffer number. You can use this to edit the<br>
buffer without having to type the name, see below.<br>
After the buffer number come the flags. Then the name of the file<br>
and the line number where the cursor was the last time.<br>
The flags that can appear are these (from left to right):<br>
<br>
u Buffer is unlisted <a class="Identifier" href="windows.html#unlisted-buffer">unlisted-buffer</a>.<br>
% Current buffer.<br>
# Alternate buffer.<br>
a Buffer is loaded and displayed.<br>
h Buffer is loaded but hidden.<br>
= Buffer is read-only.<br>
- Buffer is not modifiable, the <a class="Type" href="options.html#'modifiable'">'modifiable'</a> option is off.<br>
+ Buffer has been modified.<br>
<br>
<br>
EDITING A BUFFER<br>
<br>
You can edit a buffer by its number. That avoids having to type the file<br>
name:<br>
<br>
<div class="helpExample"> :buffer 2</div>
<br>
But the only way to know the number is by looking in the buffer list. You can<br>
use the name, or part of it, instead:<br>
<br>
<div class="helpExample"> :buffer help</div>
<br>
Vim will find the best match for the name you type. If there is only one<br>
buffer that matches the name, it will be used. In this case "help.txt".<br>
To open a buffer in a new window:<br>
<br>
<div class="helpExample"> :sbuffer 3</div>
<br>
This works with a name as well.<br>
<br>
<br>
USING THE BUFFER LIST<br>
<br>
You can move around in the buffer list with these commands:<br>
<br>
:bnext go to next buffer<br>
:bprevious go to previous buffer<br>
:bfirst go to the first buffer<br>
:blast go to the last buffer<br>
<br>
To remove a buffer from the list, use this command:<br>
<br>
<div class="helpExample"> :bdelete 3</div>
<br>
Again, this also works with a name.<br>
If you delete a buffer that was active (visible in a window), that window<br>
will be closed. If you delete the current buffer, the current window will be<br>
closed. If it was the last window, Vim will find another buffer to edit. You<br>
can't be editing nothing!<br>
<br>
<span class="Todo">Note</span>:<br>
Even after removing the buffer with ":bdelete" Vim still remembers it.<br>
It's actually made "unlisted", it no longer appears in the list from<br>
":buffers". The ":buffers!" command will list unlisted buffers (yes,<br>
Vim can do the impossible). To really make Vim forget about a buffer,<br>
use ":bwipe". Also see the <a class="Type" href="options.html#'buflisted'">'buflisted'</a> option.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
<br>
Next chapter: <a class="Identifier" href="usr_23.html">usr_23.txt</a> Editing other files<br>
<br>
Copyright: see <a class="Identifier" href="usr_01.html#manual-copyright">manual-copyright</a> vim:tw=78:ts=8:ft=help:norl:<br>
</div>
</article>
<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>
<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->
</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。