annotate runtime/doc/visual.txt @ 2373:f149bb1cf5be vim73

Make it possible to load Lua dynamically on Unix. (Luis Carvalho)
author Bram Moolenaar <bram@vim.org>
date Thu, 22 Jul 2010 21:32:16 +0200
parents 12b829477c60
children f766a1c87f69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2345
12b829477c60 Vim 7.3a -> 7.3b.
Bram Moolenaar <bram@vim.org>
parents: 2154
diff changeset
1 *visual.txt* For Vim version 7.3b. Last change: 2010 Feb 17
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 VIM REFERENCE MANUAL by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 Visual mode *Visual* *Visual-mode* *visual-mode*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 Visual mode is a flexible and easy way to select a piece of text for an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 operator. It is the only way to select a block of text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 This is introduced in section |04.4| of the user manual.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 1. Using Visual mode |visual-use|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 2. Starting and stopping Visual mode |visual-start|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 3. Changing the Visual area |visual-change|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 4. Operating on the Visual area |visual-operators|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 5. Blockwise operators |blockwise-operators|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 6. Repeating |visual-repeat|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 7. Examples |visual-examples|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 8. Select mode |Select-mode|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 {Vi has no Visual mode, the name "visual" is used for Normal mode, to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 distinguish it from Ex mode}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 {not available when the |+visual| feature was disabled when compiling}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 1. Using Visual mode *visual-use*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 Using Visual mode consists of three parts:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 1. Mark the start of the text with "v", "V" or CTRL-V.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 The character under the cursor will be used as the start.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 2. Move to the end of the text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 The text from the start of the Visual mode up to and including the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 character under the cursor is highlighted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 3. Type an operator command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 The highlighted characters will be operated upon.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 The 'highlight' option can be used to set the display mode to use for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 highlighting in Visual mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 The 'virtualedit' option can be used to allow positioning the cursor to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 positions where there is no actual character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 The highlighted text normally includes the character under the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 However, when the 'selection' option is set to "exclusive" and the cursor is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 after the Visual area, the character under the cursor is not included.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 With "v" the text before the start position and after the end position will
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 7
diff changeset
49 not be highlighted. However, all uppercase and non-alpha operators, except
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 "~" and "U", will work on whole lines anyway. See the list of operators
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 *visual-block*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 With CTRL-V (blockwise Visual mode) the highlighted text will be a rectangle
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 between start position and the cursor. However, some operators work on whole
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 lines anyway (see the list below). The change and substitute operators will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 delete the highlighted text and then start insertion at the top left
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 position.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 2. Starting and stopping Visual mode *visual-start*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 *v* *characterwise-visual*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 v start Visual mode per character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 *V* *linewise-visual*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 V start Visual mode linewise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 *CTRL-V* *blockwise-visual*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 CTRL-V start Visual mode blockwise. Note: Under Windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 CTRL-V could be mapped to paste text, it doesn't work
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 to start Visual mode then, see |CTRL-V-alternative|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 If you use <Esc>, click the left mouse button or use any command that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 does a jump to another buffer while in Visual mode, the highlighting stops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 and no text is affected. Also when you hit "v" in characterwise Visual mode,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 "CTRL-V" in blockwise Visual mode or "V" in linewise Visual mode. If you hit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 CTRL-Z the highlighting stops and the editor is suspended or a new shell is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 started |CTRL-Z|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 new mode after typing: *v_v* *v_CTRL-V* *v_V*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 old mode "v" "CTRL-V" "V" ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 Normal Visual blockwise Visual linewise Visual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 Visual Normal blockwise Visual linewise Visual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 blockwise Visual Visual Normal linewise Visual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 linewise Visual Visual blockwise Visual Normal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
548
f43150a669dc updated for version 7.0155
vimboss
parents: 236
diff changeset
89 *gv* *v_gv* *reselect-Visual*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 gv Start Visual mode with the same area as the previous
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
91 area and the same mode.
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
92 In Visual mode the current and the previous Visual
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
93 area are exchanged.
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
94 After using "p" or "P" in Visual mode the text that
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
95 was put will be selected.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 *<LeftMouse>*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 <LeftMouse> Set the current cursor position. If Visual mode is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 active it is stopped. Only when 'mouse' option is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 contains 'n' or 'a'. If the position is within 'so'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 lines from the last line on the screen the text is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 scrolled up. If the position is within 'so' lines from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 the first line on the screen the text is scrolled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 *<RightMouse>*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 <RightMouse> Start Visual mode if it is not active. The text from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 the cursor position to the position of the click is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 highlighted. If Visual mode was already active move
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 the start or end of the highlighted text, which ever
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 is closest, to the position of the click. Only when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 'mouse' option contains 'n' or 'a'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 Note: when 'mousemodel' is set to "popup",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 <S-LeftMouse> has to be used instead of <RightMouse>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 *<LeftRelease>*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 <LeftRelease> This works like a <LeftMouse>, if it is not at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 the same position as <LeftMouse>. In an older version
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 of xterm you won't see the selected area until the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 button is released, unless there is access to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 display where the xterm is running (via the DISPLAY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 environment variable or the -display argument). Only
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 when 'mouse' option contains 'n' or 'a'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 If Visual mode is not active and the "v", "V" or CTRL-V is preceded with a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 count, the size of the previously highlighted area is used for a start. You
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 can then move the end of the highlighted area and give an operator. The type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 of the old area is used (character, line or blockwise).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 - Linewise Visual mode: The number of lines is multiplied with the count.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 - Blockwise Visual mode: The number of lines and columns is multiplied with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 the count.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 - Normal Visual mode within one line: The number of characters is multiplied
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 with the count.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 - Normal Visual mode with several lines: The number of lines is multiplied
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 with the count, in the last line the same number of characters is used as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 in the last line in the previously highlighted area.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 The start of the text is the Cursor position. If the "$" command was used as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 one of the last commands to extend the highlighted text, the area will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 extended to the rightmost column of the longest line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 If you want to highlight exactly the same area as the last time, you can use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 "gv" |gv| |v_gv|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 7
diff changeset
145 *v_<Esc>*
c75153d791d0 updated for version 7.0026
vimboss
parents: 7
diff changeset
146 <Esc> In Visual mode: Stop Visual mode.
c75153d791d0 updated for version 7.0026
vimboss
parents: 7
diff changeset
147
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 *v_CTRL-C*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 CTRL-C In Visual mode: Stop Visual mode. When insert mode is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 pending (the mode message shows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 "-- (insert) VISUAL --"), it is also stopped.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 3. Changing the Visual area *visual-change*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 *v_o*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 o Go to Other end of highlighted text: The current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 cursor position becomes the start of the highlighted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 text and the cursor is moved to the other end of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 highlighted text. The highlighted area remains the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 same.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 *v_O*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 O Go to Other end of highlighted text. This is like
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 "o", but in Visual block mode the cursor moves to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 other corner in the same line. When the corner is at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 a character that occupies more than one position on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 the screen (e.g., a <Tab>), the highlighted text may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 change.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 *v_$*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 When the "$" command is used with blockwise Visual mode, the right end of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 highlighted text will be determined by the longest highlighted line. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 stops when a motion command is used that does not move straight up or down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 For moving the end of the block many commands can be used, but you cannot
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 use Ex commands, commands that make changes or abandon the file. Commands
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
178 (starting with) ".", "&", CTRL-^, "Z", CTRL-], CTRL-T, CTRL-R, CTRL-I
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 and CTRL-O cause a beep and Visual mode continues.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 When switching to another window on the same buffer, the cursor position in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 that window is adjusted, so that the same Visual area is still selected. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 is especially useful to view the start of the Visual area in one window, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 the end in another. You can then use <RightMouse> (or <S-LeftMouse> when
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 7
diff changeset
185 'mousemodel' is "popup") to drag either end of the Visual area.
7
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 4. Operating on the Visual area *visual-operators*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 The operators that can be used are:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 ~ switch case |v_~|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 d delete |v_d|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 c change (4) |v_c|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 y yank |v_y|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 > shift right (4) |v_>|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 < shift left (4) |v_<|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 ! filter through external command (1) |v_!|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 = filter through 'equalprg' option command (1) |v_=|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 gq format lines to 'textwidth' length (1) |v_gq|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 The objects that can be used are:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 aw a word (with white space) |v_aw|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 iw inner word |v_iw|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 aW a WORD (with white space) |v_aW|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 iW inner WORD |v_iW|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 as a sentence (with white space) |v_as|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 is inner sentence |v_is|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 ap a paragraph (with white space) |v_ap|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 ip inner paragraph |v_ip|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 ab a () block (with parenthesis) |v_ab|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 ib inner () block |v_ib|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 aB a {} block (with braces) |v_aB|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 iB inner {} block |v_iB|
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
214 at a <tag> </tag> block (with tags) |v_at|
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
215 it inner <tag> </tag> block |v_it|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 a< a <> block (with <>) |v_a<|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 i< inner <> block |v_i<|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 a[ a [] block (with []) |v_a[|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 i[ inner [] block |v_i[|
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
220 a" a double quoted string (with quotes) |v_aquote|
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
221 i" inner double quoted string |v_iquote|
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
222 a' a single quoted string (with quotes) |v_a'|
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
223 i' inner simple quoted string |v_i'|
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
224 a` a string in backticks (with backticks) |v_a`|
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
225 i` inner string in backticks |v_i`|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 Additionally the following commands can be used:
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
228 : start Ex command for highlighted lines (1) |v_:|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 r change (4) |v_r|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 s change |v_s|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 C change (2)(4) |v_C|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 S change (2) |v_S|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 R change (2) |v_R|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 x delete |v_x|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 D delete (3) |v_D|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 X delete (2) |v_X|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 Y yank (2) |v_Y|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 p put |v_p|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 J join (1) |v_J|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 U make uppercase |v_U|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 u make lowercase |v_u|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 ^] find tag |v_CTRL-]|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 I block insert |v_b_I|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 A block append |v_b_A|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 (1): Always whole lines, see |:visual_example|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 (2): Whole lines when not using CTRL-V.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 (3): Whole lines when not using CTRL-V, delete until the end of the line when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 using CTRL-V.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 (4): When using CTRL-V operates on the block only.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 Note that the ":vmap" command can be used to specifically map keys in Visual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 mode. For example, if you would like the "/" command not to extend the Visual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 area, but instead take the highlighted text and search for that: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 :vmap / y/<C-R>"<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 (In the <> notation |<>|, when typing it you should type it literally; you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 need to remove the 'B' and '<' flags from 'cpoptions'.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 If you want to give a register name using the """ command, do this just before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 typing the operator character: "v{move-around}"xd".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 If you want to give a count to the command, do this just before typing the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 operator character: "v{move-around}3>" (move lines 3 indents to the right).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 *{move-around}*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 The {move-around} is any sequence of movement commands. Note the difference
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 with {motion}, which is only ONE movement command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268
638
593092a5362b updated for version 7.0185
vimboss
parents: 548
diff changeset
269 Another way to operate on the Visual area is using the |/\%V| item in a
593092a5362b updated for version 7.0185
vimboss
parents: 548
diff changeset
270 pattern. For example, to replace all '(' in the Visual area with '#': >
593092a5362b updated for version 7.0185
vimboss
parents: 548
diff changeset
271
593092a5362b updated for version 7.0185
vimboss
parents: 548
diff changeset
272 :%s/\%V(/X/g
593092a5362b updated for version 7.0185
vimboss
parents: 548
diff changeset
273
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 5. Blockwise operators *blockwise-operators*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 {not available when compiled without the |+visualextra| feature}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 Reminder: Use 'virtualedit' to be able to select blocks that start or end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 after the end of a line or halfway a tab.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 Visual-block Insert *v_b_I*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 With a blockwise selection, I{string}<ESC> will insert {string} at the start
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 of block on every line of the block, provided that the line extends into the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 block. Thus lines that are short will remain unmodified. TABs are split to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 retain visual columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 See |v_b_I_example|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 Visual-block Append *v_b_A*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 With a blockwise selection, A{string}<ESC> will append {string} to the end of
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
291 block on every line of the block. There is some differing behavior where the
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 block RHS is not straight, due to different line lengths:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 1. Block was created with <C-v>$
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 In this case the string is appended to the end of each line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 2. Block was created with <C-v>{move-around}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 In this case the string is appended to the end of the block on each line,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 and whitespace is inserted to pad to the end-of-block column.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 See |v_b_A_example|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 Note: "I" and "A" behave differently for lines that don't extend into the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 selected block. This was done intentionally, so that you can do it the way
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 you want.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 Visual-block change *v_b_c*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 All selected text in the block will be replaced by the same text string. When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 using "c" the selected text is deleted and Insert mode started. You can then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 enter text (without a line break). When you hit <Esc>, the same string is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 inserted in all previously selected lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 Visual-block Change *v_b_C*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 Like using "c", but the selection is extended until the end of the line for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 all lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 *v_b_<*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 Visual-block Shift *v_b_>*
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
316 The block is shifted by 'shiftwidth'. The RHS of the block is irrelevant. The
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 LHS of the block determines the point from which to apply a right shift, and
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
318 padding includes TABs optimally according to 'ts' and 'et'. The LHS of the
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 block determines the point upto which to shift left.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 See |v_b_>_example|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 See |v_b_<_example|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 Visual-block Replace *v_b_r*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 Every screen char in the highlighted region is replaced with the same char, ie
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 TABs are split and the virtual whitespace is replaced, maintaining screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 layout.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 See |v_b_r_example|.
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 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 6. Repeating *visual-repeat*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 When repeating a Visual mode operator, the operator will be applied to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 same amount of text as the last time:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 - Linewise Visual mode: The same number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 - Blockwise Visual mode: The same number of lines and columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 - Normal Visual mode within one line: The same number of characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 - Normal Visual mode with several lines: The same number of lines, in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 last line the same number of characters as in the last line the last time.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 The start of the text is the Cursor position. If the "$" command was used as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 one of the last commands to extend the highlighted text, the repeating will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 be applied up to the rightmost column of the longest line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 7. Examples *visual-examples*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 *:visual_example*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 Currently the ":" command works on whole lines only. When you select part of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 a line, doing something like ":!date" will replace the whole line. If you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 want only part of the line to be replaced you will have to make a mapping for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 it. In a future release ":" may work on partial lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 Here is an example, to replace the selected text with the output of "date": >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 :vmap _a <Esc>`>a<CR><Esc>`<i<CR><Esc>!!date<CR>kJJ
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 (In the <> notation |<>|, when typing it you should type it literally; you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 need to remove the 'B' and '<' flags from 'cpoptions')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 What this does is:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 <Esc> stop Visual mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 `> go to the end of the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 a<CR><Esc> break the line after the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 `< jump to the start of the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 i<CR><Esc> break the line before the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 !!date<CR> filter the Visual text through date
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 kJJ Join the lines back together
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 *visual-search*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 Here is an idea for a mapping that makes it possible to do a search for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 selected text: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 :vmap X y/<C-R>"<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 (In the <> notation |<>|, when typing it you should type it literally; you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 need to remove the 'B' and '<' flags from 'cpoptions')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 Note that special characters (like '.' and '*') will cause problems.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 Visual-block Examples *blockwise-examples*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 With the following text, I will indicate the commands to produce the block and
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
381 the results below. In all cases, the cursor begins on the 'a' in the first
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 7
diff changeset
382 line of the test text.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 The following modeline settings are assumed ":ts=8:sw=4:".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 It will be helpful to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 :set hls
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 /<TAB>
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 42
diff changeset
388 where <TAB> is a real TAB. This helps visualise the operations.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 The test text is:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 abc defghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 abcdef ghi jklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 1. fo<C-v>3jISTRING<ESC> *v_b_I_example*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 abcdefghijklmnSTRINGopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 abc STRING defghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 abcdef ghi STRING jklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 abcdefghijklmnSTRINGopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 2. fo<C-v>3j$ASTRING<ESC> *v_b_A_example*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 abcdefghijklmnopqrstuvwxyzSTRING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 abc defghijklmnopqrstuvwxyzSTRING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 abcdef ghi jklmnopqrstuvwxyzSTRING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 abcdefghijklmnopqrstuvwxyzSTRING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 3. fo<C-v>3j3l<.. *v_b_<_example*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 abc defghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 abcdef ghi jklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 4. fo<C-v>3j>.. *v_b_>_example*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 abcdefghijklmn opqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 abc defghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 abcdef ghi jklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 abcdefghijklmn opqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 5. fo<C-v>5l3jrX *v_b_r_example*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 abcdefghijklmnXXXXXXuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 abc XXXXXXhijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 abcdef ghi XXXXXX jklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 abcdefghijklmnXXXXXXuvwxyz
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 8. Select mode *Select* *Select-mode*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 Select mode looks like Visual mode, but the commands accepted are quite
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 different. This resembles the selection mode in Microsoft Windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 When the 'showmode' option is set, "-- SELECT --" is shown in the last line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 Entering Select mode:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 - Using the mouse to select an area, and 'selectmode' contains "mouse".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 'mouse' must also contain a flag for the current mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 - Using a non-printable movement command, with the Shift key pressed, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 'selectmode' contains "key". For example: <S-Left> and <S-End>. 'keymodel'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 must also contain "startsel".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 - Using "v", "V" or CTRL-V command, and 'selectmode' contains "cmd".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 - Using "gh", "gH" or "g_CTRL-H" command in Normal mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 - From Visual mode, press CTRL-G. *v_CTRL-G*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 Commands in Select mode:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 - Printable characters, <NL> and <CR> cause the selection to be deleted, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 Vim enters Insert mode. The typed character is inserted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 - Non-printable movement commands, with the Shift key pressed, extend the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 selection. 'keymodel' must include "startsel".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 - Non-printable movement commands, with the Shift key NOT pressed, stop Select
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 mode. 'keymodel' must include "stopsel".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 - ESC stops Select mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 - CTRL-O switches to Visual mode for the duration of one command. *v_CTRL-O*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 - CTRL-G switches to Visual mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 Otherwise, typed characters are handled as in Visual mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 When using an operator in Select mode, and the selection is linewise, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 selected lines are operated upon, but like in characterwise selection. For
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 example, when a whole line is deleted, it can later be pasted halfway a line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 Mappings and menus in Select mode. *Select-mode-mapping*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468
788
b5aed52a4881 updated for version 7.0230
vimboss
parents: 638
diff changeset
469 When mappings and menus are defined with the |:vmap| or |:vmenu| command they
b5aed52a4881 updated for version 7.0230
vimboss
parents: 638
diff changeset
470 work both in Visual mode and in Select mode. When these are used in Select
b5aed52a4881 updated for version 7.0230
vimboss
parents: 638
diff changeset
471 mode Vim automatically switches to Visual mode, so that the same behavior as
b5aed52a4881 updated for version 7.0230
vimboss
parents: 638
diff changeset
472 in Visual mode is effective. If you don't want this use |:xmap| or |:smap|.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
474 Users will expect printable characters to replace the selected area.
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
475 Therefore avoid mapping printable characters in Select mode. Or use
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
476 |:sunmap| after |:map| and |:vmap| to remove it for Select mode.
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
477
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 After the mapping or menu finishes, the selection is enabled again and Select
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 mode entered, unless the selected area was deleted, another buffer became
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 the current one or the window layout was changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 When a character was typed that causes the selection to be deleted and Insert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 mode started, Insert mode mappings are applied to this character. This may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 cause some confusion, because it means Insert mode mappings apply to a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 character typed in Select mode. Language mappings apply as well.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 *gV* *v_gV*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 gV Avoid the automatic reselection of the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 after a Select mode mapping or menu has finished.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 Put this just before the end of the mapping or menu.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 At least it should be after any operations on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 selection.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 *gh*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 gh Start Select mode, characterwise. This is like "v",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 but starts Select mode instead of Visual mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 Mnemonic: "get highlighted".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 *gH*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 gH Start Select mode, linewise. This is like "V",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 but starts Select mode instead of Visual mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 Mnemonic: "get Highlighted".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 *g_CTRL-H*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 g CTRL-H Start Select mode, blockwise. This is like CTRL-V,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 but starts Select mode instead of Visual mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 Mnemonic: "get Highlighted".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 vim:tw=78:ts=8:ft=help:norl: