annotate runtime/doc/usr_22.txt @ 25944:837198c91a25

Added tag v8.2.3505 for changeset dbf6a2066091b681ca3e885206b0dbf3743963d1
author Bram Moolenaar <Bram@vim.org>
date Wed, 13 Oct 2021 16:45:04 +0200
parents 1908e92b02fd
children f8116058ca76
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19968
1908e92b02fd Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
1 *usr_22.txt* For Vim version 8.2. Last change: 2020 Mar 28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 VIM USER MANUAL - by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 Finding the file to edit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 Files can be found everywhere. So how do you find them? Vim offers various
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 ways to browse the directory tree. There are commands to jump to a file that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 is mentioned in another. And Vim remembers which files have been edited
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 before.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
13 |22.1| The file browser
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 |22.2| The current directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 |22.3| Finding a file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 |22.4| The buffer list
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 Next chapter: |usr_23.txt| Editing other files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 Previous chapter: |usr_21.txt| Go away and come back
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 Table of contents: |usr_toc.txt|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 ==============================================================================
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
23 *22.1* The file browser
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 Vim has a plugin that makes it possible to edit a directory. Try this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 :edit .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 Through the magic of autocommands and Vim scripts, the window will be filled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 with the contents of the directory. It looks like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
32 " ============================================================================ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
33 " Netrw Directory Listing (netrw v109) ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
34 " Sorted by name ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
35 " Sort sequence: [\/]$,\.h$,\.c$,\.cpp$,*,\.info$,\.swp$,\.o$\.obj$,\.bak$ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
36 " Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
37 " ============================================================================ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
38 ../ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
39 ./ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
40 check/ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
41 Makefile ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
42 autocmd.txt ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
43 change.txt ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
44 eval.txt~ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
45 filetype.txt~ ~
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
46 help.txt.info ~
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 You can see these items:
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
49
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
50 1. The name of the browsing tool and its version number
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
51 2. The name of the browsing directory
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
52 3. The method of sorting (may be by name, time, or size)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
53 4. How names are to be sorted (directories first, then *.h files,
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
54 *.c files, etc)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
55 5. How to get help (use the <F1> key), and an abbreviated listing
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
56 of available commands
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
57 6. A listing of files, including "../", which allows one to list
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
58 the parent directory.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 If you have syntax highlighting enabled, the different parts are highlighted
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
61 so as to make it easier to spot them.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 You can use Normal mode Vim commands to move around in the text. For example,
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
64 move the cursor atop a file and press <Enter>; you will then be editing that
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
65 file. To go back to the browser use ":edit ." again, or use ":Explore".
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
66 CTRL-O also works.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
67
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
68 Try using <Enter> while the cursor is atop a directory name. The result is
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
69 that the file browser moves into that directory and displays the items found
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 there. Pressing <Enter> on the first directory "../" moves you one level
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 higher. Pressing "-" does the same thing, without the need to move to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 "../" item first.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
74 You can press <F1> to get help on the things you can do in the netrw file
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
75 browser. This is what you get: >
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
76
18831
6848b809a26e Runtime file updates.
Bram Moolenaar <Bram@vim.org>
parents: 16808
diff changeset
77 9. Directory Browsing netrw-browse netrw-dir netrw-list netrw-help
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
18831
6848b809a26e Runtime file updates.
Bram Moolenaar <Bram@vim.org>
parents: 16808
diff changeset
79 MAPS netrw-maps
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
80 <F1>.............Help.......................................|netrw-help|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
81 <cr>.............Browsing...................................|netrw-cr|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
82 <del>............Deleting Files or Directories..............|netrw-delete|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
83 -................Going Up...................................|netrw--|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
84 a................Hiding Files or Directories................|netrw-a|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
85 mb...............Bookmarking a Directory....................|netrw-mb|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
86 gb...............Changing to a Bookmarked Directory.........|netrw-gb|
19968
1908e92b02fd Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
87 cd...............Make Browsing Directory The Current Dir....|netrw-c|
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
88 d................Make A New Directory.......................|netrw-d|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
89 D................Deleting Files or Directories..............|netrw-D|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
90 <c-h>............Edit File/Directory Hiding List............|netrw-ctrl-h|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
91 i................Change Listing Style.......................|netrw-i|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
92 <c-l>............Refreshing the Listing.....................|netrw-ctrl-l|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
93 o................Browsing with a Horizontal Split...........|netrw-o|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
94 p................Use Preview Window.........................|netrw-p|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
95 P................Edit in Previous Window....................|netrw-p|
10498
883396809b45 commit https://github.com/vim/vim/commit/bc2eada5424bff06f7eb77c032ecc067da52b846
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
96 q................Listing Bookmarks and History..............|netrw-qb|
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
97 r................Reversing Sorting Order....................|netrw-r|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
98 < (etc)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
100 The <F1> key thus brings you to a netrw directory browsing contents help page.
2207
b17bbfa96fa0 Add the settabvar() and gettabvar() functions.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
101 It's a regular help page; use the usual |CTRL-]| to jump to tagged help items
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
102 and |CTRL-O| to jump back.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
103
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
104 To select files for display and editing: (with the cursor is atop a filename)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
106 <enter> Open the file in the current window. |netrw-cr|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
107 o Horizontally split window and display file |netrw-o|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
108 v Vertically split window and display file |netrw-v|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
109 p Use the |preview-window| |netrw-p|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
110 P Edit in the previous window |netrw-P|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
111 t Open file in a new tab |netrw-t|
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
112
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
113 The following normal-mode commands may be used to control the browser display:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
115 i Controls listing style (thin, long, wide, and tree).
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
116 The long listing includes size and date information.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
117 s Repeatedly pressing s will change the way the files
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
118 are sorted; one may sort on name, modification time,
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
119 or size.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
120 r Reverse the sorting order.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
121
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
122 As a sampling of extra normal-mode commands:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
19968
1908e92b02fd Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
124 cd Change Vim's notion of the current directory to be
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
125 the same as the browser directory. (see
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
126 |g:netrw_keepdir| to control this, too)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
127 R Rename the file or directory under the cursor; a
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
128 prompt will be issued for the new name.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
129 D Delete the file or directory under the cursor; a
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
130 confirmation request will be issued.
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
131 mb gb Make bookmark/goto bookmark
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
132
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
133
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
134 One may also use command mode; again, just a sampling:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
136 :Explore [directory] Browse specified/current directory
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
137 :NetrwSettings A comprehensive list of your current netrw
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
138 settings with help linkage.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
140 The netrw browser is not limited to just your local machine; one may use
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
141 urls such as: (that trailing / is important)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
142
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
143 :Explore ftp://somehost/path/to/dir/
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
144 :e scp://somehost/path/to/dir/
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
145
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
146 See |netrw-browse| for more.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 *22.2* The current directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 Just like the shell, Vim has the concept of a current directory. Suppose you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 are in your home directory and want to edit several files in a directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 "VeryLongFileName". You could do: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 :edit VeryLongFileName/file1.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 :edit VeryLongFileName/file2.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 :edit VeryLongFileName/file3.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 To avoid much of the typing, do this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 :cd VeryLongFileName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 :edit file1.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 :edit file2.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 :edit file3.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 The ":cd" command changes the current directory. You can see what the current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 directory is with the ":pwd" command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 /home/Bram/VeryLongFileName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 Vim remembers the last directory that you used. Use "cd -" to go back to it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 Example: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 /home/Bram/VeryLongFileName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 :cd /etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 /etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 :cd -
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 /home/Bram/VeryLongFileName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 :cd -
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 /etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 WINDOW LOCAL DIRECTORY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 When you split a window, both windows use the same current directory. When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 you want to edit a number of files somewhere else in the new window, you can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 make it use a different directory, without changing the current directory in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 the other window. This is called a local directory. >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 /home/Bram/VeryLongFileName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 :split
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 :lcd /etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 /etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 CTRL-W w
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 :pwd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 /home/Bram/VeryLongFileName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
205 So long as no `:lcd` command has been used, all windows share the same current
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
206 directory. Doing a `:cd` command in one window will also change the current
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 directory of the other window.
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
208 For a window where `:lcd` has been used a different current directory is
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
209 remembered. Using `:cd` or `:lcd` in other windows will not change it.
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
210 When using a `:cd` command in a window that uses a different current
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 directory, it will go back to using the shared directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
213
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
214 TAB LOCAL DIRECTORY
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
215
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
216 When you open a new tab page, it uses the directory of the window in the
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
217 previous tab page from which the new tab page was opened. You can change the
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
218 directory of the current tab page using the `:tcd` command. All the windows in
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
219 a tab page share this directory except for windows with a window-local
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
220 directory. Any new windows opened in this tab page will use this directory as
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
221 the current working directory. Using a `:cd` command in a tab page will not
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
222 change the working directory of tab pages which have a tab local directory.
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16553
diff changeset
223 When the global working directory is changed using the `:cd` command in a tab
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
224 page, it will also change the current tab page working directory.
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
225
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
226
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 *22.3* Finding a file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 You are editing a C program that contains this line:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 #include "inits.h" ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 You want to see what is in that "inits.h" file. Move the cursor on the name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 of the file and type: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 gf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 Vim will find the file and edit it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 What if the file is not in the current directory? Vim will use the 'path'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 option to find the file. This option is a list of directory names where to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 look for your file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 Suppose you have your include files located in "c:/prog/include". This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 command will add it to the 'path' option: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 :set path+=c:/prog/include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 This directory is an absolute path. No matter where you are, it will be the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 same place. What if you have located files in a subdirectory, below where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 file is? Then you can specify a relative path name. This starts with a dot:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 :set path+=./proto
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 This tells Vim to look in the directory "proto", below the directory where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 file in which you use "gf" is. Thus using "gf" on "inits.h" will make Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 look for "proto/inits.h", starting in the directory of the file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 Without the "./", thus "proto", Vim would look in the "proto" directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 below the current directory. And the current directory might not be where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 file that you are editing is located.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 The 'path' option allows specifying the directories where to search for files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 in many more ways. See the help on the 'path' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 The 'isfname' option is used to decide which characters are included in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 file name, and which ones are not (e.g., the " character in the example
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 above).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 When you know the file name, but it's not to be found in the file, you can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 type it: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 :find inits.h
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 Vim will then use the 'path' option to try and locate the file. This is the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 same as the ":edit" command, except for the use of 'path'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 To open the found file in a new window use CTRL-W f instead of "gf", or use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 ":sfind" instead of ":find".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 A nice way to directly start Vim to edit a file somewhere in the 'path': >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 vim "+find stdio.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 This finds the file "stdio.h" in your value of 'path'. The quotes are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 necessary to have one argument |-+c|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 *22.4* The buffer list
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 The Vim editor uses the term buffer to describe a file being edited.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 Actually, a buffer is a copy of the file that you edit. When you finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 changing the buffer, you write the contents of the buffer to the file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 Buffers not only contain file contents, but also all the marks, settings, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 other stuff that goes with it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 HIDDEN BUFFERS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 Suppose you are editing the file one.txt and need to edit the file two.txt.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 You could simply use ":edit two.txt", but since you made changes to one.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 that won't work. You also don't want to write one.txt yet. Vim has a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 solution for you: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 :hide edit two.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 The buffer "one.txt" disappears from the screen, but Vim still knows that you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 are editing this buffer, so it keeps the modified text. This is called a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 hidden buffer: The buffer contains text, but you can't see it.
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
308 The argument of ":hide" is another command. ":hide" makes that command
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1232
diff changeset
309 behave as if the 'hidden' option was set. You could also set this option
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 yourself. The effect is that when any buffer is abandoned, it becomes hidden.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 Be careful! When you have hidden buffers with changes, don't exit Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 without making sure you have saved all the buffers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 INACTIVE BUFFERS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 When a buffer has been used once, Vim remembers some information about it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 When it is not displayed in a window and it is not hidden, it is still in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 buffer list. This is called an inactive buffer. Overview:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 Active Appears in a window, text loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 Hidden Not in a window, text loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 Inactive Not in a window, no text loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 The inactive buffers are remembered, because Vim keeps information about them,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 like marks. And remembering the file name is useful too, so that you can see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 which files you have edited. And edit them again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 LISTING BUFFERS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 View the buffer list with this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 :buffers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 A command which does the same, is not so obvious to list buffers, but is much
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 shorter to type: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 :ls
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 The output could look like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
343 1 #h "help.txt" line 62 ~
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
344 2 %a + "usr_21.txt" line 1 ~
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
345 3 "usr_toc.txt" line 1 ~
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 The first column contains the buffer number. You can use this to edit the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 buffer without having to type the name, see below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 After the buffer number come the flags. Then the name of the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 and the line number where the cursor was the last time.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 The flags that can appear are these (from left to right):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 u Buffer is unlisted |unlisted-buffer|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 % Current buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 # Alternate buffer.
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 9
diff changeset
356 a Buffer is loaded and displayed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 h Buffer is loaded but hidden.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 = Buffer is read-only.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 - Buffer is not modifiable, the 'modifiable' option is off.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 + Buffer has been modified.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 EDITING A BUFFER
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 You can edit a buffer by its number. That avoids having to type the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 name: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 :buffer 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 But the only way to know the number is by looking in the buffer list. You can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 use the name, or part of it, instead: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 :buffer help
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374
2207
b17bbfa96fa0 Add the settabvar() and gettabvar() functions.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
375 Vim will find the best match for the name you type. If there is only one
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 buffer that matches the name, it will be used. In this case "help.txt".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 To open a buffer in a new window: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 :sbuffer 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 This works with a name as well.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 USING THE BUFFER LIST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 You can move around in the buffer list with these commands:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 :bnext go to next buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 :bprevious go to previous buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 :bfirst go to the first buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 :blast go to the last buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 To remove a buffer from the list, use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 :bdelete 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 Again, this also works with a name.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 If you delete a buffer that was active (visible in a window), that window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 will be closed. If you delete the current buffer, the current window will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 closed. If it was the last window, Vim will find another buffer to edit. You
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 can't be editing nothing!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 Note:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 Even after removing the buffer with ":bdelete" Vim still remembers it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 It's actually made "unlisted", it no longer appears in the list from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 ":buffers". The ":buffers!" command will list unlisted buffers (yes,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 Vim can do the impossible). To really make Vim forget about a buffer,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 use ":bwipe". Also see the 'buflisted' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 Next chapter: |usr_23.txt| Editing other files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413
14519
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13963
diff changeset
414 Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: