annotate runtime/doc/usr_08.txt @ 234:a686fd6c8beb v7.0065

updated for version 7.0065
author vimboss
date Mon, 28 Mar 2005 21:02:15 +0000
parents 3fc0f57ecb91
children 4707450c2b33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 *usr_08.txt* For Vim version 7.0aa. Last change: 2004 Jun 04
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 Splitting windows
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 Display two different files above each other. Or view two locations in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 file at the same time. See the difference between two files by putting them
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 side by side. All this is possible with split windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 |08.1| Split a window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 |08.2| Split a window on another file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 |08.3| Window size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 |08.4| Vertical splits
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 |08.5| Moving windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 |08.6| Commands for all windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 |08.7| Viewing differences with vimdiff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 |08.8| Various
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 Next chapter: |usr_09.txt| Using the GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 Previous chapter: |usr_07.txt| Editing more than one file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 Table of contents: |usr_toc.txt|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 *08.1* Split a window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 The easiest way to open a new window is to use the following command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 :split
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 This command splits the screen into two windows and leaves the cursor in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 top one:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 +----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 |/* file one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 |one.c=============================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 |/* file one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 |one.c=============================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 +----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 What you see here is two windows on the same file. The line with "====" is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 that status line. It displays information about the window above it. (In
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 practice the status line will be in reverse video.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 The two windows allow you to view two parts of the same file. For example,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 you could make the top window show the variable declarations of a program, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 the bottom one the code that uses these variables.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 The CTRL-W w command can be used to jump between the windows. If you are in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 the top window, CTRL-W w jumps to the window below it. If you are in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 bottom window it will jump to the first window. (CTRL-W CTRL-W does the same
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 thing, in case you let go of the CTRL key a bit later.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 CLOSE THE WINDOW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 To close a window, use the command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 :close
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 Actually, any command that quits editing a file works, like ":quit" and "ZZ".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 But ":close" prevents you from accidentally exiting Vim when you close the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 last window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 CLOSING ALL OTHER WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 If you have opened a whole bunch of windows, but now want to concentrate on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 one of them, this command will be useful: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 :only
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 This closes all windows, except for the current one. If any of the other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 windows has changes, you will get an error message and that window won't be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 closed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 *08.2* Split a window on another file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 The following command opens a second window and starts editing the given file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 :split two.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 If you were editing one.c, then the result looks like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 +----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 |/* file two.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 |two.c=============================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 |/* file one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 |one.c=============================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 +----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 To open a window on a new, empty file, use this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 :new
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 You can repeat the ":split" and ":new" commands to create as many windows as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 you like.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 *08.3* Window size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 The ":split" command can take a number argument. If specified, this will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 the height of the new window. For example, the following opens a new window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 three lines high and starts editing the file alpha.c: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 :3split alpha.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 For existing windows you can change the size in several ways. When you have a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 working mouse, it is easy: Move the mouse pointer to the status line that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 separates two windows, and drag it up or down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 To increase the size of a window: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 CTRL-W +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 To decrease it: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 CTRL-W -
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 Both of these commands take a count and increase or decrease the window size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 by that many lines. Thus "4 CTRL-W +" make the window four lines higher.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 To set the window height to a specified number of lines: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 {height}CTRL-W _
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 That's: a number {height}, CTRL-W and then an underscore (the - key with Shift
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 on English-US keyboards).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 To make a window as high as it can be, use the CTRL-W _ command without a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 count.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 USING THE MOUSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 In Vim you can do many things very quickly from the keyboard. Unfortunately,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 the window resizing commands require quite a bit of typing. In this case,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 using the mouse is faster. Position the mouse pointer on a status line. Now
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 press the left mouse button and drag. The status line will move, thus making
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 the window on one side higher and the other smaller.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 OPTIONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 The 'winheight' option can be set to a minimal desired height of a window and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 'winminheight' to a hard minimum height.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 Likewise, there is 'winwidth' for the minimal desired width and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 'winminwidth' for the hard minimum width.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 The 'equalalways' option, when set, makes Vim equalize the windows sizes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 when a window is closed or opened.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 *08.4* Vertical splits
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 The ":split" command creates the new window above the current one. To make
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 the window appear at the left side, use: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 :vsplit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 or: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 :vsplit two.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 The result looks something like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 +--------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 |/* file two.c */ |/* file one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 |two.c===============one.c=============|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 +--------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 Actually, the | lines in the middle will be in reverse video. This is called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 the vertical separator. It separates the two windows left and right of it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 There is also the ":vnew" command, to open a vertically split window on a new,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 empty file. Another way to do this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 :vertical new
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 The ":vertical" command can be inserted before another command that splits a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 window. This will cause that command to split the window vertically instead
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 of horizontally. (If the command doesn't split a window, it works
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 unmodified.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 MOVING BETWEEN WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 Since you can split windows horizontally and vertically as much as you like,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 you can create any layout of windows. Then you can use these commands to move
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 between them:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 CTRL-W h move to the window on the left
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 CTRL-W j move to the window below
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 CTRL-W k move to the window above
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 CTRL-W l move to the window on the right
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 CTRL-W t move to the TOP window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 CTRL-W b move to the BOTTOM window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 You will notice the same letters as used for moving the cursor. And the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 cursor keys can also be used, if you like.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 More commands to move to other windows: |Q_wi|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 *08.5* Moving windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 You have split a few windows, but now they are in the wrong place. Then you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 need a command to move the window somewhere else. For example, you have three
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 windows like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 +----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 |/* file two.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 |two.c=============================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 |/* file three.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 |three.c===========================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 |/* file one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 |one.c=============================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 +----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 Clearly the last one should be at the top. Go to that window (using CTRL-W w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 and the type this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 CTRL-W K
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 This uses the uppercase letter K. What happens is that the window is moved to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 the very top. You will notice that K is again used for moving upwards.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 When you have vertical splits, CTRL-W K will move the current window to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 top and make it occupy the full with of the Vim window. If this is your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 layout:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 +-------------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 |/* two.c */ |/* three.c */ |/* one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 |~ |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 |~ |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 |~ |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 |~ |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 |~ |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 |two.c=========three.c=========one.c========|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 +-------------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 Then using CTRL-W K in the middle window (three.c) will result in:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 +-------------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 |/* three.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 |three.c====================================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 |/* two.c */ |/* one.c */ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 |~ |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 |two.c==================one.c===============|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 +-------------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 The other three similar commands (you can probably guess these now):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 CTRL-W H move window to the far left
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 CTRL-W J move window to the bottom
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 CTRL-W L move window to the far right
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 *08.6* Commands for all windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 When you have several windows open and you want to quit Vim, you can close
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 each window separately. A quicker way is using this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 :qall
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 This stands for "quit all". If any of the windows contain changes, Vim will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 not exit. The cursor will automatically be positioned in a window with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 changes. You can then either use ":write" to save the changes, or ":quit!" to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 throw them away.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 If you know there are windows with changes, and you want to save all these
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 changes, use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 :wall
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 This stands for "write all". But actually, it only writes files with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 changes. Vim knows it doesn't make sense to write files that were not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 And then there is the combination of ":qall" and ":wall": the "write and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 quit all" command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 :wqall
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 This writes all modified files and quits Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 Finally, there is a command that quits Vim and throws away all changes: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 :qall!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 Be careful, there is no way to undo this command!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 OPENING A WINDOW FOR ALL ARGUMENTS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 To make Vim open a window for each file, start it with the "-o" argument: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 vim -o one.txt two.txt three.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 This results in:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 +-------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 |file one.txt |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 |one.txt========================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 |file two.txt |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 |two.txt========================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 |file three.txt |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 |~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 |three.txt======================|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 +-------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 The "-O" argument is used to get vertically split windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 When Vim is already running, the ":all" command opens a window for each
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 file in the argument list. ":vertical all" does it with vertical splits.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 *08.7* Viewing differences with vimdiff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 There is a special way to start Vim, which shows the differences between two
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 files. Let's take a file "main.c" and insert a few characters in one line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 Write this file with the 'backup' option set, so that the backup file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 "main.c~" will contain the previous version of the file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 Type this command in a shell (not in Vim): >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 vimdiff main.c~ main.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 Vim will start, with two windows side by side. You will only see the line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 in which you added characters, and a few lines above and below it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 VV VV
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 +-----------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 |+ +--123 lines: /* a|+ +--123 lines: /* a| <- fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 | text | changed text | <- changed line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 | text | ------------------| <- deleted line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 | text | text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 |+ +--432 lines: text|+ +--432 lines: text| <- fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 | ~ | ~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 | ~ | ~ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 |main.c~==============main.c==============|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 +-----------------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 (This picture doesn't show the highlighting, use the vimdiff command for a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 better look.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 The lines that were not modified have been collapsed into one line. This is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 called a closed fold. They are indicated in the picture with "<- fold". Thus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 the single fold line at the top stands for 123 text lines. These lines are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 equal in both files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 The line marked with "<- changed line" is highlighted, and the inserted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 text is displayed with another color. This clearly shows what the difference
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 is between the two files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 The line that was deleted is displayed with "---" in the main.c window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 See the "<- deleted line" marker in the picture. These characters are not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 really there. They just fill up main.c, so that it displays the same number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 of lines as the other window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 THE FOLD COLUMN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 Each window has a column on the left with a slightly different background. In
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 the picture above these are indicated with "VV". You notice there is a plus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 character there, in front of each closed fold. Move the mouse pointer to that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 plus and click the left button. The fold will open, and you can see the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 that it contains.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 The fold column contains a minus sign for an open fold. If you click on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 this -, the fold will close.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 Obviously, this only works when you have a working mouse. You can also use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 "zo" to open a fold and "zc" to close it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 DIFFING IN VIM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 Another way to start in diff mode can be done from inside Vim. Edit the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 "main.c" file, then make a split and show the differences: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 :edit main.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 :vertical diffsplit main.c~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 The ":vertical" command is used to make the window split vertically. If you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 omit this, you will get a horizontal split.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 If you have a patch or diff file, you can use the third way to start diff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 mode. First edit the file to which the patch applies. Then tell Vim the name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 of the patch file: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 :edit main.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 :vertical diffpatch main.c.diff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 WARNING: The patch file must contain only one patch, for the file you are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 editing. Otherwise you will get a lot of error messages, and some files might
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 be patched unexpectedly.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 The patching will only be done to the copy of the file in Vim. The file on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 your harddisk will remain unmodified (until you decide to write the file).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 SCROLL BINDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 When the files have more changes, you can scroll in the usual way. Vim will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 try to keep both the windows start at the same position, so you can easily see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 the differences side by side.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 When you don't want this for a moment, use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 :set noscrollbind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 JUMPING TO CHANGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 When you have disabled folding in some way, it may be difficult to find the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 changes. Use this command to jump forward to the next change: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 ]c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 To go the other way use: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 [c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 Prepended a count to jump further away.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 REMOVING CHANGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 You can move text from one window to the other. This either removes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 differences or adds new ones. Vim doesn't keep the highlighting updated in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 all situations. To update it use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 :diffupdate
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 To remove a difference, you can move the text in a highlighted block from one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 window to another. Take the "main.c" and "main.c~" example above. Move the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 cursor to the left window, on the line that was deleted in the other window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 Now type this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 dp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 The change will be removed by putting the text of the current window in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 other window. "dp" stands for "diff put".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 You can also do it the other way around. Move the cursor to the right
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 window, to the line where "changed" was inserted. Now type this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 The change will now be removed by getting the text from the other window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 Since there are no changes left now, Vim puts all text in a closed fold.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 "do" stands for "diff obtain". "dg" would have been better, but that already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 has a different meaning ("dgg" deletes from the cursor until the first line).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 For details about diff mode, see |vimdiff|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 *08.8* Various
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 The 'laststatus' option can be used to specify when the last window has a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 statusline:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 0 never
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 1 only when there are split windows (the default)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 2 always
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 Many commands that edit another file have a variant that splits the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 For Command-line commands this is done by prepending an "s". For example:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 ":tag" jumps to a tag, ":stag" splits the window and jumps to a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 tag.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 For Normal mode commands a CTRL-W is prepended. CTRL-^ jumps to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 alternate file, CTRL-W CTRL-^ splits the window and edits the alternate file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 The 'splitbelow' option can be set to make a new window appear below the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 current window. The 'splitright' option can be set to make a vertically split
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 window appear right of the current window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 When splitting a window you can prepend a modifier command to tell where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 window is to appear:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 :leftabove {cmd} left or above the current window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 :aboveleft {cmd} idem
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 :rightbelow {cmd} right or below the current window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 :belowright {cmd} idem
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 :topleft {cmd} at the top or left of the Vim window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 :botright {cmd} at the bottom or right of the Vim window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 Next chapter: |usr_09.txt| Using the GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl: