Mercurial > vim
annotate src/testdir/test_mapping.vim @ 16494:373cf579e4ca
Added tag v8.1.1250 for changeset 4912193bc5e7c3ebf6ccf54a030e52c0d3917b56
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 03 May 2019 13:45:06 +0200 |
parents | fb7cf38a1c7a |
children | a5c3d374e1d3 |
rev | line source |
---|---|
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for mappings and abbreviations |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
3 source shared.vim |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
4 |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func Test_abbreviation() |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 " abbreviation with 0x80 should work |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 inoreab чкпр vim |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call feedkeys("Goчкпр \<Esc>", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call assert_equal('vim ', getline('$')) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 iunab чкпр |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 endfunc |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
16389
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
14 func Test_abclear() |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
15 abbrev foo foobar |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
16 iabbrev fooi foobari |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
17 cabbrev fooc foobarc |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
18 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
19 \ .. "c fooc foobarc\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
20 \ .. "i fooi foobari\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
21 \ .. "! foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
22 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
23 iabclear |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
24 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
25 \ .. "c fooc foobarc\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
26 \ .. "c foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
27 abbrev foo foobar |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
28 iabbrev fooi foobari |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
29 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
30 cabclear |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
31 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
32 \ .. "i fooi foobari\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
33 \ .. "i foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
34 abbrev foo foobar |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
35 cabbrev fooc foobarc |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
36 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
37 abclear |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
38 call assert_equal("\n\nNo abbreviation found", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
39 endfunc |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
40 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
41 func Test_abclear_buffer() |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
42 abbrev foo foobar |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
43 new X1 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
44 abbrev <buffer> foo1 foobar1 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
45 new X2 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
46 abbrev <buffer> foo2 foobar2 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
47 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
48 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
49 \ .. "! foo2 @foobar2\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
50 \ .. "! foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
51 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
52 abclear <buffer> |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
53 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
54 \ .. "! foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
55 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
56 b X1 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
57 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
58 \ .. "! foo1 @foobar1\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
59 \ .. "! foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
60 abclear <buffer> |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
61 call assert_equal("\n\n" |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
62 \ .. "! foo foobar", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
63 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
64 abclear |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
65 call assert_equal("\n\nNo abbreviation found", execute('abbrev')) |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
66 |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
67 %bwipe |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
68 endfunc |
fb7cf38a1c7a
patch 8.1.1199: no test for :abclear
Bram Moolenaar <Bram@vim.org>
parents:
16101
diff
changeset
|
69 |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 func Test_map_ctrl_c_insert() |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 " mapping of ctrl-c in Insert mode |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 set cpo-=< cpo-=k |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 inoremap <c-c> <ctrl-c> |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 cnoremap <c-c> dummy |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 cunmap <c-c> |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 call feedkeys("GoTEST2: CTRL-C |\<C-C>A|\<Esc>", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call assert_equal('TEST2: CTRL-C |<ctrl-c>A|', getline('$')) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 unmap! <c-c> |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 endfunc |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 func Test_map_ctrl_c_visual() |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 " mapping of ctrl-c in Visual mode |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 vnoremap <c-c> :<C-u>$put ='vmap works' |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call feedkeys("GV\<C-C>\<CR>", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_equal('vmap works', getline('$')) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 vunmap <c-c> |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 endfunc |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 func Test_map_langmap() |
9925
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
92 if !has('langmap') |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
93 return |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
94 endif |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
95 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
96 " check langmap applies in normal mode |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
97 set langmap=+- nolangremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
98 new |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
99 call setline(1, ['a', 'b', 'c']) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
100 2 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
101 call assert_equal('b', getline('.')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
102 call feedkeys("+", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
103 call assert_equal('a', getline('.')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
104 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
105 " check no remapping |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
106 map x + |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
107 2 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
108 call feedkeys("x", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
109 call assert_equal('c', getline('.')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
110 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
111 " check with remapping |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
112 set langremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
113 2 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
114 call feedkeys("x", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
115 call assert_equal('a', getline('.')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
116 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
117 unmap x |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
118 bwipe! |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
119 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
120 " 'langnoremap' follows 'langremap' and vise versa |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
121 set langremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
122 set langnoremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
123 call assert_equal(0, &langremap) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
124 set langremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
125 call assert_equal(0, &langnoremap) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
126 set nolangremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
127 call assert_equal(1, &langnoremap) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
128 |
10070
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
129 " check default values |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
130 set langnoremap& |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
131 call assert_equal(0, &langnoremap) |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
132 call assert_equal(1, &langremap) |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
133 set langremap& |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
134 call assert_equal(0, &langnoremap) |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
135 call assert_equal(1, &langremap) |
09c7df6f8dd3
commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents:
9925
diff
changeset
|
136 |
9925
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
137 " langmap should not apply in insert mode, 'langremap' doesn't matter |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
138 set langmap=+{ nolangremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
139 call feedkeys("Go+\<Esc>", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
140 call assert_equal('+', getline('$')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
141 set langmap=+{ langremap |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 call feedkeys("Go+\<Esc>", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 call assert_equal('+', getline('$')) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 |
9925
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
145 " langmap used for register name in insert mode. |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
146 call setreg('a', 'aaaa') |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
147 call setreg('b', 'bbbb') |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
148 call setreg('c', 'cccc') |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
149 set langmap=ab langremap |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
150 call feedkeys("Go\<C-R>a\<Esc>", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
151 call assert_equal('bbbb', getline('$')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
152 call feedkeys("Go\<C-R>\<C-R>a\<Esc>", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
153 call assert_equal('bbbb', getline('$')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
154 " mapping does not apply |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
155 imap c a |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
156 call feedkeys("Go\<C-R>c\<Esc>", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
157 call assert_equal('cccc', getline('$')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
158 imap a c |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
159 call feedkeys("Go\<C-R>a\<Esc>", "xt") |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
160 call assert_equal('bbbb', getline('$')) |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
161 |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
162 " langmap should not apply in Command-line mode |
3fba3e8326a7
commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents:
9869
diff
changeset
|
163 set langmap=+{ nolangremap |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 call feedkeys(":call append(line('$'), '+')\<CR>", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 call assert_equal('+', getline('$')) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 |
10787
09926123316b
patch 8.0.0283: mode() does not indicate Insert mode completion
Christian Brabandt <cb@256bit.org>
parents:
10070
diff
changeset
|
167 iunmap a |
09926123316b
patch 8.0.0283: mode() does not indicate Insert mode completion
Christian Brabandt <cb@256bit.org>
parents:
10070
diff
changeset
|
168 iunmap c |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 endfunc |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 func Test_map_feedkeys() |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 " issue #212 (feedkeys insert mapping at current position) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 nnoremap . :call feedkeys(".", "in")<cr> |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 call setline('$', ['a b c d', 'a b c d']) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 $-1 |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 call feedkeys("0qqdw.ifoo\<Esc>qj0@q\<Esc>", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 call assert_equal(['fooc d', 'fooc d'], getline(line('$') - 1, line('$'))) |
10787
09926123316b
patch 8.0.0283: mode() does not indicate Insert mode completion
Christian Brabandt <cb@256bit.org>
parents:
10070
diff
changeset
|
179 nunmap . |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 endfunc |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 func Test_map_cursor() |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 " <c-g>U<cursor> works only within a single line |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 imapclear |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 imap ( ()<c-g>U<left> |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 call feedkeys("G2o\<Esc>ki\<CR>Test1: text with a (here some more text\<Esc>k.", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 call assert_equal('Test1: text with a (here some more text)', getline(line('$') - 2)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 call assert_equal('Test1: text with a (here some more text)', getline(line('$') - 1)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 " test undo |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 call feedkeys("G2o\<Esc>ki\<CR>Test2: text wit a (here some more text [und undo]\<C-G>u\<Esc>k.u", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 call assert_equal('', getline(line('$') - 2)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 call assert_equal('Test2: text wit a (here some more text [und undo])', getline(line('$') - 1)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 imapclear |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 endfunc |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 |
16101
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
199 func Test_map_cursor_ctrl_gU() |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
200 " <c-g>U<cursor> works only within a single line |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
201 nnoremap c<* *Ncgn<C-r>"<C-G>U<S-Left> |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
202 call setline(1, ['foo', 'foobar', '', 'foo']) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
203 call cursor(1,2) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
204 call feedkeys("c<*PREFIX\<esc>.", 'xt') |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
205 call assert_equal(['PREFIXfoo', 'foobar', '', 'PREFIXfoo'], getline(1,'$')) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
206 " break undo manually |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
207 set ul=1000 |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
208 exe ":norm! uu" |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
209 call assert_equal(['foo', 'foobar', '', 'foo'], getline(1,'$')) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
210 |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
211 " Test that it does not work if the cursor moves to the previous line |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
212 " 2 times <S-Left> move to the previous line |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
213 nnoremap c<* *Ncgn<C-r>"<C-G>U<S-Left><C-G>U<S-Left> |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
214 call setline(1, ['', ' foo', 'foobar', '', 'foo']) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
215 call cursor(2,3) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
216 call feedkeys("c<*PREFIX\<esc>.", 'xt') |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
217 call assert_equal(['PREFIXPREFIX', ' foo', 'foobar', '', 'foo'], getline(1,'$')) |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
218 nmapclear |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
219 endfunc |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
220 |
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
221 |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 " This isn't actually testing a mapping, but similar use of CTRL-G U as above. |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 func Test_break_undo() |
16101
5c5d211bd5a8
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
224 set whichwrap=<,>,[,] |
9867
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 call feedkeys("G4o2k", "xt") |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>." |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 call assert_equal('new line here', getline(line('$') - 3)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 call assert_equal('Test3: text with a (parenthesis here', getline(line('$') - 2)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 call assert_equal('new line here', getline(line('$') - 1)) |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 set nomodified |
86f73f026a9a
commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 endfunc |
9869
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
232 |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
233 func Test_map_meta_quotes() |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
234 imap <M-"> foo |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
235 call feedkeys("Go-\<M-\">-\<Esc>", "xt") |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
236 call assert_equal("-foo-", getline('$')) |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
237 set nomodified |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
238 iunmap <M-"> |
989d44d35a66
commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents:
9867
diff
changeset
|
239 endfunc |
11295
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
240 |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
241 func Test_abbr_after_line_join() |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
242 new |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
243 abbr foo bar |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
244 set backspace=indent,eol,start |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
245 exe "normal o\<BS>foo " |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
246 call assert_equal("bar ", getline(1)) |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
247 bwipe! |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
248 unabbr foo |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
249 set backspace& |
d772bf077b3f
patch 8.0.0533: abbreviation doesn't work after backspacing newline
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
250 endfunc |
11403
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
251 |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
252 func Test_map_timeout() |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
253 if !has('timers') |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
254 return |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
255 endif |
11403
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
256 nnoremap aaaa :let got_aaaa = 1<CR> |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
257 nnoremap bb :let got_bb = 1<CR> |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
258 nmap b aaa |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
259 new |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
260 func ExitInsert(timer) |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
261 let g:line = getline(1) |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
262 call feedkeys("\<Esc>", "t") |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
263 endfunc |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
264 set timeout timeoutlen=200 |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
265 let timer = timer_start(300, 'ExitInsert') |
11403
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
266 " After the 'b' Vim waits for another character to see if it matches 'bb'. |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
267 " When it times out it is expanded to "aaa", but there is no wait for |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
268 " "aaaa". Can't check that reliably though. |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
269 call feedkeys("b", "xt!") |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
270 call assert_equal("aa", g:line) |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
271 call assert_false(exists('got_aaa')) |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
272 call assert_false(exists('got_bb')) |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
273 |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
274 bwipe! |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
275 nunmap aaaa |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
276 nunmap bb |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
277 nunmap b |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
278 set timeoutlen& |
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
279 delfunc ExitInsert |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
280 call timer_stop(timer) |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
281 endfunc |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
282 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
283 func Test_map_timeout_with_timer_interrupt() |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
284 if !has('job') || !has('timers') |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
285 return |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
286 endif |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
287 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
288 " Confirm the timer invoked in exit_cb of the job doesn't disturb mapped key |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
289 " sequence. |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
290 new |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
291 let g:val = 0 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
292 nnoremap \12 :let g:val = 1<CR> |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
293 nnoremap \123 :let g:val = 2<CR> |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
294 set timeout timeoutlen=1000 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
295 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
296 func ExitCb(job, status) |
15687
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15659
diff
changeset
|
297 let g:timer = timer_start(1, {-> feedkeys("3\<Esc>", 't')}) |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
298 endfunc |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
299 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
300 call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'}) |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
301 call feedkeys('\12', 'xt!') |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
302 call assert_equal(2, g:val) |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
303 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
304 bwipe! |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
305 nunmap \12 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
306 nunmap \123 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
307 set timeoutlen& |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
308 call WaitFor({-> exists('g:timer')}) |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
309 call timer_stop(g:timer) |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
310 unlet g:timer |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
311 unlet g:val |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
312 delfunc ExitCb |
11403
74a40efb39ea
patch 8.0.0586: no test for mapping timing out
Christian Brabandt <cb@256bit.org>
parents:
11295
diff
changeset
|
313 endfunc |
13788
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
314 |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
315 func Test_abbreviation_CR() |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
316 new |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
317 func Eatchar(pat) |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
318 let c = nr2char(getchar(0)) |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
319 return (c =~ a:pat) ? '' : c |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
320 endfunc |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
321 iabbrev <buffer><silent> ~~7 <c-r>=repeat('~', 7)<CR><c-r>=Eatchar('\s')<cr> |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
322 call feedkeys("GA~~7 \<esc>", 'xt') |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
323 call assert_equal('~~~~~~~', getline('$')) |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
324 %d |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
325 call feedkeys("GA~~7\<cr>\<esc>", 'xt') |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
326 call assert_equal(['~~~~~~~', ''], getline(1,'$')) |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
327 delfunc Eatchar |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
328 bw! |
a27d380b257f
patch 8.0.1766: expanding abbreviation doesn't work
Christian Brabandt <cb@256bit.org>
parents:
11403
diff
changeset
|
329 endfunc |
13933
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
330 |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
331 func Test_cabbr_visual_mode() |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
332 cabbr s su |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
333 call feedkeys(":s \<c-B>\"\<CR>", 'itx') |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
334 call assert_equal('"su ', getreg(':')) |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
335 call feedkeys(":'<,'>s \<c-B>\"\<CR>", 'itx') |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
336 let expected = '"'. "'<,'>su " |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
337 call assert_equal(expected, getreg(':')) |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
338 call feedkeys(": '<,'>s \<c-B>\"\<CR>", 'itx') |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
339 let expected = '" '. "'<,'>su " |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
340 call assert_equal(expected, getreg(':')) |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
341 call feedkeys(":'a,'bs \<c-B>\"\<CR>", 'itx') |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
342 let expected = '"'. "'a,'bsu " |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
343 call assert_equal(expected, getreg(':')) |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
344 cunabbr s |
bea665293ea0
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Christian Brabandt <cb@256bit.org>
parents:
13788
diff
changeset
|
345 endfunc |
15279
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
346 |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
347 func Test_motionforce_omap() |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
348 func GetCommand() |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
349 let g:m=mode(1) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
350 let [g:lnum1, g:col1] = searchpos('-', 'Wb') |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
351 if g:lnum1 == 0 |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
352 return "\<Esc>" |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
353 endif |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
354 let [g:lnum2, g:col2] = searchpos('-', 'W') |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
355 if g:lnum2 == 0 |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
356 return "\<Esc>" |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
357 endif |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
358 return ":call Select()\<CR>" |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
359 endfunc |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
360 func Select() |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
361 call cursor([g:lnum1, g:col1]) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
362 exe "normal! 1 ". (strlen(g:m) == 2 ? 'v' : g:m[2]) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
363 call cursor([g:lnum2, g:col2]) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
364 execute "normal! \<BS>" |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
365 endfunc |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
366 new |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
367 onoremap <buffer><expr> i- GetCommand() |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
368 " 1) default omap mapping |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
369 %d_ |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
370 call setline(1, ['aaa - bbb', 'x', 'ddd - eee']) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
371 call cursor(2, 1) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
372 norm di- |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
373 call assert_equal('no', g:m) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
374 call assert_equal(['aaa -- eee'], getline(1, '$')) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
375 " 2) forced characterwise operation |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
376 %d_ |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
377 call setline(1, ['aaa - bbb', 'x', 'ddd - eee']) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
378 call cursor(2, 1) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
379 norm dvi- |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
380 call assert_equal('nov', g:m) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
381 call assert_equal(['aaa -- eee'], getline(1, '$')) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
382 " 3) forced linewise operation |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
383 %d_ |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
384 call setline(1, ['aaa - bbb', 'x', 'ddd - eee']) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
385 call cursor(2, 1) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
386 norm dVi- |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
387 call assert_equal('noV', g:m) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
388 call assert_equal([''], getline(1, '$')) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
389 " 4) forced blockwise operation |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
390 %d_ |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
391 call setline(1, ['aaa - bbb', 'x', 'ddd - eee']) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
392 call cursor(2, 1) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
393 exe "norm d\<C-V>i-" |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
394 call assert_equal("no\<C-V>", g:m) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
395 call assert_equal(['aaabbb', 'x', 'dddeee'], getline(1, '$')) |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
396 bwipe! |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
397 delfunc Select |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
398 delfunc GetCommand |
54457fc4af0b
patch 8.1.0648: custom operators can't act upon a forced motion
Bram Moolenaar <Bram@vim.org>
parents:
13933
diff
changeset
|
399 endfunc |