Mercurial > vim
annotate src/testdir/test94.in @ 16879:3fc7f1139ab4
Added tag v8.1.1440 for changeset 4096722cd9c136fa9f5e65f0b8961ebd547f9b4a
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Jun 2019 17:15:05 +0200 |
parents | ae45d497868f |
children |
rev | line source |
---|---|
4274 | 1 Test for Visual mode and operators |
2 | |
3 Tests for the two kinds of operations: Those executed with Visual mode | |
4 followed by an operator and those executed via Operator-pending mode. Also | |
5 part of the test are mappings, counts, and repetition with the . command. | |
6 | |
7 Test cases: | |
8 - Visual modes (v V CTRL-V) followed by an operator; count; repeating | |
9 - Visual mode maps; count; repeating | |
10 - Simple | |
11 - With an Ex command (custom text object) | |
12 - Operator-pending mode maps | |
13 - Simple | |
14 - With Ex command moving the cursor | |
15 - With Ex command and Visual selection (custom text object) | |
16 - Patch 7.3.879: Properly abort Ex command in Operator-pending mode | |
17 | |
18 STARTTEST | |
19 :so small.vim | |
11091
ae45d497868f
patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents:
7246
diff
changeset
|
20 :set belloff=all |
7246
a69b5e4beefd
commit https://github.com/vim/vim/commit/cfcd1ddd103129b309671cba5cff55e19a9908e4
Christian Brabandt <cb@256bit.org>
parents:
7241
diff
changeset
|
21 :set enc=utf-8 nocp viminfo+=nviminfo |
4274 | 22 : |
23 :" User functions | |
24 :function MoveToCap() | |
25 : call search('\u', 'W') | |
26 :endfunction | |
27 :function SelectInCaps() | |
28 : let [line1, col1] = searchpos('\u', 'bcnW') | |
29 : let [line2, col2] = searchpos('.\u', 'nW') | |
30 : call setpos("'<", [0, line1, col1, 0]) | |
31 : call setpos("'>", [0, line2, col2, 0]) | |
32 : normal! gv | |
33 :endfunction | |
34 : | |
35 :" Visual modes followed by operator | |
36 /^apple | |
37 lvld.l3vd.: | |
38 /^line 1 | |
39 Vcnewlinej.j2Vd.: | |
40 /^xxxx | |
41 jlc l.l2c----l.: | |
42 : | |
43 :" Visual mode maps (movement and text object) | |
44 :vnoremap W /\u/s-1<CR> | |
45 :vnoremap iW :<C-U>call SelectInCaps()<CR> | |
46 /^Kiwi | |
47 vWcNol.fD2vd.: | |
48 /^Jambu | |
49 llviWc-l.l2vdl.: | |
50 : | |
51 :" Operator-pending mode maps (movement and text object) | |
52 :onoremap W /\u/<CR> | |
53 :onoremap <Leader>W :<C-U>call MoveToCap()<CR> | |
54 :onoremap iW :<C-U>call SelectInCaps()<CR> | |
55 /^Pineapple | |
56 cW-l.l2.l.: | |
57 /^Juniper | |
58 g?\WfD.: | |
59 /^Lemon | |
4346 | 60 yiWPlciWNewfr.: |
4274 | 61 : |
62 :" Patch 7.3.879: Properly abort Operator-pending mode for "dv:<Esc>" etc. | |
63 /^zzzz | |
64 dV: dv: :set noma | let v:errmsg = '' | |
65 d: :set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed' | |
66 dv:dV::set noma | let v:errmsg = '' | |
67 d::set ma | put = v:errmsg =~# '^E21' ? 'failed' : 'ok' | |
6826 | 68 : |
69 :$put ='' | |
70 :$put ='characterwise visual mode: replace last line' | |
71 :$put ='a' | |
72 :let @" = 'x' | |
73 :let v:errmsg = '' | |
74 v$p | |
75 :$put ='---' | |
76 :$put ='v:errmsg='.v:errmsg | |
77 : | |
78 :$put ='' | |
79 :$put ='characterwise visual mode: delete middle line' | |
80 :$put ='a' | |
81 :$put ='b' | |
82 :$put ='c' | |
83 kkv$d | |
84 :$put ='---' | |
85 : | |
86 :$put ='' | |
87 :$put ='characterwise visual mode: delete middle two line' | |
88 :$put ='a' | |
89 :$put ='b' | |
90 :$put ='c' | |
91 kkvj$d | |
92 :$put ='---' | |
93 : | |
94 :$put ='' | |
95 :$put ='characterwise visual mode: delete last line' | |
96 :$put ='a' | |
97 :$put ='b' | |
98 :$put ='c' | |
99 v$d | |
100 :$put ='---' | |
101 : | |
102 :$put ='' | |
103 :$put ='characterwise visual mode: delete last two line' | |
104 :$put ='a' | |
105 :$put ='b' | |
106 :$put ='c' | |
107 kvj$d | |
108 :$put ='---' | |
109 : | |
110 :" Select mode maps | |
111 :snoremap <lt>End> <End> | |
112 :snoremap <lt>Down> <Down> | |
113 :snoremap <lt>Del> <Del> | |
114 : | |
115 :$put ='' | |
116 :$put ='characterwise select mode: delete middle line' | |
117 :$put ='a' | |
118 :$put ='b' | |
119 :$put ='c' | |
120 kkgh<End><Del> | |
121 :$put ='---' | |
122 : | |
123 :$put ='' | |
124 :$put ='characterwise select mode: delete middle two line' | |
125 :$put ='a' | |
126 :$put ='b' | |
127 :$put ='c' | |
128 kkgh<Down><End><Del> | |
129 :$put ='---' | |
130 : | |
131 :$put ='' | |
132 :$put ='characterwise select mode: delete last line' | |
133 :$put ='a' | |
134 :$put ='b' | |
135 :$put ='c' | |
136 gh<End><Del> | |
137 :$put ='---' | |
138 : | |
139 :$put ='' | |
140 :$put ='characterwise select mode: delete last two line' | |
141 :$put ='a' | |
142 :$put ='b' | |
143 :$put ='c' | |
144 kgh<Down><End><Del> | |
145 :$put ='---' | |
146 : | |
147 :$put ='' | |
148 :$put ='linewise select mode: delete middle line' | |
149 :$put ='a' | |
150 :$put ='b' | |
151 :$put ='c' | |
152 kkgH<Del> | |
153 :$put ='---' | |
154 : | |
155 :$put ='' | |
156 :$put ='linewise select mode: delete middle two line' | |
157 :$put ='a' | |
158 :$put ='b' | |
159 :$put ='c' | |
160 kkgH<Down><Del> | |
161 :$put ='---' | |
162 : | |
163 :$put ='' | |
164 :$put ='linewise select mode: delete last line' | |
165 :$put ='a' | |
166 :$put ='b' | |
167 :$put ='c' | |
168 gH<Del> | |
169 :$put ='---' | |
170 : | |
171 :$put ='' | |
172 :$put ='linewise select mode: delete last two line' | |
173 :$put ='a' | |
174 :$put ='b' | |
175 :$put ='c' | |
176 kgH<Down><Del> | |
177 :$put ='---' | |
6845 | 178 : |
179 :$put ='' | |
180 :$put ='v_p: replace last character with line register at middle line' | |
181 :$put ='aaa' | |
182 :$put ='bbb' | |
183 :$put ='ccc' | |
184 :-2yank | |
185 k$vp | |
186 :$put ='---' | |
187 : | |
188 :$put ='' | |
189 :$put ='v_p: replace last character with line register at middle line selecting newline' | |
190 :$put ='aaa' | |
191 :$put ='bbb' | |
192 :$put ='ccc' | |
193 :-2yank | |
194 k$v$p | |
195 :$put ='---' | |
196 : | |
197 :$put ='' | |
198 :$put ='v_p: replace last character with line register at last line' | |
199 :$put ='aaa' | |
200 :$put ='bbb' | |
201 :$put ='ccc' | |
202 :-2yank | |
203 $vp | |
204 :$put ='---' | |
205 : | |
206 :$put ='' | |
207 :$put ='v_p: replace last character with line register at last line selecting newline' | |
208 :$put ='aaa' | |
209 :$put ='bbb' | |
210 :$put ='ccc' | |
211 :-2yank | |
212 $v$p | |
213 :$put ='---' | |
7241
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
214 : |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
215 :$put ='' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
216 :$put ='gv in exclusive select mode after operation' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
217 :$put ='zzz ' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
218 :$put ='äà ' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
219 :set selection=exclusive |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
220 kv3lyjv3lpgvcxxx |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
221 :$put ='---' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
222 : |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
223 :$put ='' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
224 :$put ='gv in exclusive select mode without operation' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
225 :$put ='zzz ' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
226 :set selection=exclusive |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
227 0v3lgvcxxx |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
228 :$put ='---' |
4274 | 229 :/^start:/+2,$w! test.out |
230 :q! | |
231 ENDTEST | |
232 | |
233 start: | |
234 | |
235 apple banana cherry | |
236 | |
237 line 1 line 1 | |
238 line 2 line 2 | |
239 line 3 line 3 | |
240 line 4 line 4 | |
241 line 5 line 5 | |
242 line 6 line 6 | |
243 | |
244 xxxxxxxxxxxxx | |
245 xxxxxxxxxxxxx | |
246 xxxxxxxxxxxxx | |
247 xxxxxxxxxxxxx | |
248 | |
249 KiwiRaspberryDateWatermelonPeach | |
250 JambuRambutanBananaTangerineMango | |
251 | |
252 PineappleQuinceLoganberryOrangeGrapefruitKiwiZ | |
253 JuniperDurianZ | |
254 LemonNectarineZ | |
255 | |
256 zzzz | |
257 zzzz |