diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-24 20:21:19 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-24 20:21:19 +0100 |
commit | 7f51bbe0d19f1f0cb0321326f45a17b4f5155f89 (patch) | |
tree | 45f2a17e61cc8c5407b25da693102ba0b825a104 /src/testdir/test_mapping.vim | |
parent | 03c3bd9fd094c1aede2e8fe3ad8fd25b9f033053 (diff) | |
download | vim-git-7f51bbe0d19f1f0cb0321326f45a17b4f5155f89.tar.gz |
patch 8.2.0148: mapping related function in wrong source filev8.2.0148
Problem: Mapping related function in wrong source file.
Solution: Move the function. Add a few more test cases. (Yegappan
Lakshmanan, closes #5528)
Diffstat (limited to 'src/testdir/test_mapping.vim')
-rw-r--r-- | src/testdir/test_mapping.vim | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index 92ffc53eb..7aeb23c14 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -476,6 +476,15 @@ func Test_list_mappings() call assert_equal(['n ,n <Nop>'], \ execute('nmap ,n')->trim()->split("\n")) + " verbose map + call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$", + \ execute('verbose map ,n')->trim()->split("\n")[1]) + + " map to CTRL-V + exe "nmap ,k \<C-V>" + call assert_equal(['n ,k <Nop>'], + \ execute('nmap ,k')->trim()->split("\n")) + nmapclear endfunc @@ -812,4 +821,36 @@ func Test_abbr_remove() call assert_equal({}, maparg('foo', 'i', 1, 1)) endfunc +" Trigger an abbreviation using a special key +func Test_abbr_trigger_special() + new + iabbr teh the + call feedkeys("iteh\<F2>\<Esc>", 'xt') + call assert_equal('the<F2>', getline(1)) + iunab teh + close! +endfunc + +" Test for '<' in 'cpoptions' +func Test_map_cpo_special_keycode() + set cpo-=< + imap x<Bslash>k Test + let d = maparg('x<Bslash>k', 'i', 0, 1) + call assert_equal(['x\k', 'Test', 'i'], [d.lhs, d.rhs, d.mode]) + call feedkeys(":imap x\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"imap x\k', @:) + iunmap x<Bslash>k + set cpo+=< + imap x<Bslash>k Test + let d = maparg('x<Bslash>k', 'i', 0, 1) + call assert_equal(['x<Bslash>k', 'Test', 'i'], [d.lhs, d.rhs, d.mode]) + call feedkeys(":imap x\<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"imap x<Bslash>k', @:) + iunmap x<Bslash>k + set cpo-=< + " Modifying 'cpo' above adds some default mappings, remove them + mapclear + mapclear! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |