annotate src/testdir/test_mapping.vim @ 10070:09c7df6f8dd3 v7.4.2306

commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 2 19:34:10 2016 +0200 patch 7.4.2306 Problem: Default value for 'langremap' is wrong. Solution: Set the right value. (J?rgen Kr?mer) Add a test.
author Christian Brabandt <cb@256bit.org>
date Fri, 02 Sep 2016 19:45:08 +0200
parents 3fba3e8326a7
children 09926123316b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('multi_byte')
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_abbreviation()
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 " abbreviation with 0x80 should work
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 inoreab чкпр vim
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call feedkeys("Goчкпр \<Esc>", "xt")
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal('vim ', getline('$'))
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 iunab чкпр
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endfunc
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 func Test_map_ctrl_c_insert()
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " mapping of ctrl-c in Insert mode
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 set cpo-=< cpo-=k
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 inoremap <c-c> <ctrl-c>
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 cnoremap <c-c> dummy
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 cunmap <c-c>
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 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
23 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
24 unmap! <c-c>
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 endfunc
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 func Test_map_ctrl_c_visual()
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " mapping of ctrl-c in Visual mode
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 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
31 call feedkeys("GV\<C-C>\<CR>", "xt")
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal('vmap works', getline('$'))
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 vunmap <c-c>
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfunc
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 func Test_map_langmap()
9925
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
38 if !has('langmap')
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
39 return
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
40 endif
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
41
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
42 " check langmap applies in normal mode
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
43 set langmap=+- nolangremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
44 new
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
45 call setline(1, ['a', 'b', 'c'])
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
46 2
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
47 call assert_equal('b', getline('.'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
48 call feedkeys("+", "xt")
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
49 call assert_equal('a', getline('.'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
50
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
51 " check no remapping
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
52 map x +
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
53 2
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
54 call feedkeys("x", "xt")
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
55 call assert_equal('c', getline('.'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
56
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
57 " check with remapping
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
58 set langremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
59 2
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
60 call feedkeys("x", "xt")
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
61 call assert_equal('a', getline('.'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
62
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
63 unmap x
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
64 bwipe!
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
65
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
66 " 'langnoremap' follows 'langremap' and vise versa
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
67 set langremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
68 set langnoremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
69 call assert_equal(0, &langremap)
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
70 set langremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
71 call assert_equal(0, &langnoremap)
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
72 set nolangremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
73 call assert_equal(1, &langnoremap)
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
74
10070
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
75 " check default values
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
76 set langnoremap&
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
77 call assert_equal(0, &langnoremap)
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
78 call assert_equal(1, &langremap)
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
79 set langremap&
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
80 call assert_equal(0, &langnoremap)
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
81 call assert_equal(1, &langremap)
09c7df6f8dd3 commit https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1
Christian Brabandt <cb@256bit.org>
parents: 9925
diff changeset
82
9925
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
83 " 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
84 set langmap=+{ nolangremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
85 call feedkeys("Go+\<Esc>", "xt")
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
86 call assert_equal('+', getline('$'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
87 set langmap=+{ langremap
9867
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call feedkeys("Go+\<Esc>", "xt")
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call assert_equal('+', getline('$'))
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90
9925
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
91 " 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
92 call setreg('a', 'aaaa')
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
93 call setreg('b', 'bbbb')
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
94 call setreg('c', 'cccc')
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
95 set langmap=ab langremap
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
96 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
97 call assert_equal('bbbb', getline('$'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
98 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
99 call assert_equal('bbbb', getline('$'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
100 " mapping does not apply
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
101 imap c a
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
102 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
103 call assert_equal('cccc', getline('$'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
104 imap a c
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
105 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
106 call assert_equal('bbbb', getline('$'))
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
107
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9869
diff changeset
108 " 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
109 set langmap=+{ nolangremap
9867
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call assert_equal('+', getline('$'))
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 endfunc
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 func Test_map_feedkeys()
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 " 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
118 nnoremap . :call feedkeys(".", "in")<cr>
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 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
120 $-1
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 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
122 call assert_equal(['fooc d', 'fooc d'], getline(line('$') - 1, line('$')))
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 unmap .
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 endfunc
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 func Test_map_cursor()
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 " <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
129 imapclear
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 imap ( ()<c-g>U<left>
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 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
132 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
133 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
134
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 " test undo
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 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
137 call assert_equal('', getline(line('$') - 2))
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 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
139 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 imapclear
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 endfunc
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 " 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
144 func Test_break_undo()
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 :set whichwrap=<,>,[,]
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 call feedkeys("G4o2k", "xt")
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 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
148 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
149 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
150 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
151 set nomodified
86f73f026a9a commit https://github.com/vim/vim/commit/2d1a248762f069e470acde389ff4686a45d2f817
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 endfunc
9869
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
153
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
154 func Test_map_meta_quotes()
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
155 imap <M-"> foo
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
156 call feedkeys("Go-\<M-\">-\<Esc>", "xt")
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
157 call assert_equal("-foo-", getline('$'))
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
158 set nomodified
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
159 iunmap <M-">
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9867
diff changeset
160 endfunc