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'
|
|
67 :/^start:/+2,$w! test.out
|
|
68 :q!
|
|
69 ENDTEST
|
|
70
|
|
71 start:
|
|
72
|
|
73 apple banana cherry
|
|
74
|
|
75 line 1 line 1
|
|
76 line 2 line 2
|
|
77 line 3 line 3
|
|
78 line 4 line 4
|
|
79 line 5 line 5
|
|
80 line 6 line 6
|
|
81
|
|
82 xxxxxxxxxxxxx
|
|
83 xxxxxxxxxxxxx
|
|
84 xxxxxxxxxxxxx
|
|
85 xxxxxxxxxxxxx
|
|
86
|
|
87 KiwiRaspberryDateWatermelonPeach
|
|
88 JambuRambutanBananaTangerineMango
|
|
89
|
|
90 PineappleQuinceLoganberryOrangeGrapefruitKiwiZ
|
|
91 JuniperDurianZ
|
|
92 LemonNectarineZ
|
|
93
|
|
94 zzzz
|
|
95 zzzz
|