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
|
4329
|
20 :set nocp viminfo+=nviminfo
|
4274
|
21 :
|
|
22 :" User functions
|
|
23 :function MoveToCap()
|
|
24 : call search('\u', 'W')
|
|
25 :endfunction
|
|
26 :function SelectInCaps()
|
|
27 : let [line1, col1] = searchpos('\u', 'bcnW')
|
|
28 : let [line2, col2] = searchpos('.\u', 'nW')
|
|
29 : call setpos("'<", [0, line1, col1, 0])
|
|
30 : call setpos("'>", [0, line2, col2, 0])
|
|
31 : normal! gv
|
|
32 :endfunction
|
|
33 :
|
|
34 :" Visual modes followed by operator
|
|
35 /^apple
|
|
36 lvld.l3vd.:
|
|
37 /^line 1
|
|
38 Vcnewlinej.j2Vd.:
|
|
39 /^xxxx
|
|
40 jlc l.l2c----l.:
|
|
41 :
|
|
42 :" Visual mode maps (movement and text object)
|
|
43 :vnoremap W /\u/s-1<CR>
|
|
44 :vnoremap iW :<C-U>call SelectInCaps()<CR>
|
|
45 /^Kiwi
|
|
46 vWcNol.fD2vd.:
|
|
47 /^Jambu
|
|
48 llviWc-l.l2vdl.:
|
|
49 :
|
|
50 :" Operator-pending mode maps (movement and text object)
|
|
51 :onoremap W /\u/<CR>
|
|
52 :onoremap <Leader>W :<C-U>call MoveToCap()<CR>
|
|
53 :onoremap iW :<C-U>call SelectInCaps()<CR>
|
|
54 /^Pineapple
|
|
55 cW-l.l2.l.:
|
|
56 /^Juniper
|
|
57 g?\WfD.:
|
|
58 /^Lemon
|
4346
|
59 yiWPlciWNewfr.:
|
4274
|
60 :
|
|
61 :" Patch 7.3.879: Properly abort Operator-pending mode for "dv:<Esc>" etc.
|
|
62 /^zzzz
|
|
63 dV:
dv:
:set noma | let v:errmsg = ''
|
|
64 d:
:set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed'
|
|
65 dv:dV::set noma | let v:errmsg = ''
|
|
66 d::set ma | put = v:errmsg =~# '^E21' ? 'failed' : 'ok'
|
6826
|
67 :
|
|
68 :$put =''
|
|
69 :$put ='characterwise visual mode: replace last line'
|
|
70 :$put ='a'
|
|
71 :let @" = 'x'
|
|
72 :let v:errmsg = ''
|
|
73 v$p
|
|
74 :$put ='---'
|
|
75 :$put ='v:errmsg='.v:errmsg
|
|
76 :
|
|
77 :$put =''
|
|
78 :$put ='characterwise visual mode: delete middle line'
|
|
79 :$put ='a'
|
|
80 :$put ='b'
|
|
81 :$put ='c'
|
|
82 kkv$d
|
|
83 :$put ='---'
|
|
84 :
|
|
85 :$put =''
|
|
86 :$put ='characterwise visual mode: delete middle two line'
|
|
87 :$put ='a'
|
|
88 :$put ='b'
|
|
89 :$put ='c'
|
|
90 kkvj$d
|
|
91 :$put ='---'
|
|
92 :
|
|
93 :$put =''
|
|
94 :$put ='characterwise visual mode: delete last line'
|
|
95 :$put ='a'
|
|
96 :$put ='b'
|
|
97 :$put ='c'
|
|
98 v$d
|
|
99 :$put ='---'
|
|
100 :
|
|
101 :$put =''
|
|
102 :$put ='characterwise visual mode: delete last two line'
|
|
103 :$put ='a'
|
|
104 :$put ='b'
|
|
105 :$put ='c'
|
|
106 kvj$d
|
|
107 :$put ='---'
|
|
108 :
|
|
109 :" Select mode maps
|
|
110 :snoremap <lt>End> <End>
|
|
111 :snoremap <lt>Down> <Down>
|
|
112 :snoremap <lt>Del> <Del>
|
|
113 :
|
|
114 :$put =''
|
|
115 :$put ='characterwise select mode: delete middle line'
|
|
116 :$put ='a'
|
|
117 :$put ='b'
|
|
118 :$put ='c'
|
|
119 kkgh<End><Del>
|
|
120 :$put ='---'
|
|
121 :
|
|
122 :$put =''
|
|
123 :$put ='characterwise select mode: delete middle two line'
|
|
124 :$put ='a'
|
|
125 :$put ='b'
|
|
126 :$put ='c'
|
|
127 kkgh<Down><End><Del>
|
|
128 :$put ='---'
|
|
129 :
|
|
130 :$put =''
|
|
131 :$put ='characterwise select mode: delete last line'
|
|
132 :$put ='a'
|
|
133 :$put ='b'
|
|
134 :$put ='c'
|
|
135 gh<End><Del>
|
|
136 :$put ='---'
|
|
137 :
|
|
138 :$put =''
|
|
139 :$put ='characterwise select mode: delete last two line'
|
|
140 :$put ='a'
|
|
141 :$put ='b'
|
|
142 :$put ='c'
|
|
143 kgh<Down><End><Del>
|
|
144 :$put ='---'
|
|
145 :
|
|
146 :$put =''
|
|
147 :$put ='linewise select mode: delete middle line'
|
|
148 :$put ='a'
|
|
149 :$put ='b'
|
|
150 :$put ='c'
|
|
151 kkgH<Del>
|
|
152 :$put ='---'
|
|
153 :
|
|
154 :$put =''
|
|
155 :$put ='linewise select mode: delete middle two line'
|
|
156 :$put ='a'
|
|
157 :$put ='b'
|
|
158 :$put ='c'
|
|
159 kkgH<Down><Del>
|
|
160 :$put ='---'
|
|
161 :
|
|
162 :$put =''
|
|
163 :$put ='linewise select mode: delete last line'
|
|
164 :$put ='a'
|
|
165 :$put ='b'
|
|
166 :$put ='c'
|
|
167 gH<Del>
|
|
168 :$put ='---'
|
|
169 :
|
|
170 :$put =''
|
|
171 :$put ='linewise select mode: delete last two line'
|
|
172 :$put ='a'
|
|
173 :$put ='b'
|
|
174 :$put ='c'
|
|
175 kgH<Down><Del>
|
|
176 :$put ='---'
|
6845
|
177 :
|
|
178 :$put =''
|
|
179 :$put ='v_p: replace last character with line register at middle line'
|
|
180 :$put ='aaa'
|
|
181 :$put ='bbb'
|
|
182 :$put ='ccc'
|
|
183 :-2yank
|
|
184 k$vp
|
|
185 :$put ='---'
|
|
186 :
|
|
187 :$put =''
|
|
188 :$put ='v_p: replace last character with line register at middle line selecting newline'
|
|
189 :$put ='aaa'
|
|
190 :$put ='bbb'
|
|
191 :$put ='ccc'
|
|
192 :-2yank
|
|
193 k$v$p
|
|
194 :$put ='---'
|
|
195 :
|
|
196 :$put =''
|
|
197 :$put ='v_p: replace last character with line register at last line'
|
|
198 :$put ='aaa'
|
|
199 :$put ='bbb'
|
|
200 :$put ='ccc'
|
|
201 :-2yank
|
|
202 $vp
|
|
203 :$put ='---'
|
|
204 :
|
|
205 :$put =''
|
|
206 :$put ='v_p: replace last character with line register at last line selecting newline'
|
|
207 :$put ='aaa'
|
|
208 :$put ='bbb'
|
|
209 :$put ='ccc'
|
|
210 :-2yank
|
|
211 $v$p
|
|
212 :$put ='---'
|
4274
|
213 :/^start:/+2,$w! test.out
|
|
214 :q!
|
|
215 ENDTEST
|
|
216
|
|
217 start:
|
|
218
|
|
219 apple banana cherry
|
|
220
|
|
221 line 1 line 1
|
|
222 line 2 line 2
|
|
223 line 3 line 3
|
|
224 line 4 line 4
|
|
225 line 5 line 5
|
|
226 line 6 line 6
|
|
227
|
|
228 xxxxxxxxxxxxx
|
|
229 xxxxxxxxxxxxx
|
|
230 xxxxxxxxxxxxx
|
|
231 xxxxxxxxxxxxx
|
|
232
|
|
233 KiwiRaspberryDateWatermelonPeach
|
|
234 JambuRambutanBananaTangerineMango
|
|
235
|
|
236 PineappleQuinceLoganberryOrangeGrapefruitKiwiZ
|
|
237 JuniperDurianZ
|
|
238 LemonNectarineZ
|
|
239
|
|
240 zzzz
|
|
241 zzzz
|