diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-04-29 17:13:28 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-29 17:13:28 +0800 |
| commit | 35a7b0f9b991e884eae81aa7393f9701b7b7b85e (patch) | |
| tree | 127035623b99f2088be616fd316e162ede23e973 /src/nvim/testdir/test_mapping.vim | |
| parent | c671822d4da5f8b772fff7acc3eae16df714e68f (diff) | |
| parent | 3601cef1377937f01347b20a8c6c303f5f429f51 (diff) | |
| download | rneovim-35a7b0f9b991e884eae81aa7393f9701b7b7b85e.tar.gz rneovim-35a7b0f9b991e884eae81aa7393f9701b7b7b85e.tar.bz2 rneovim-35a7b0f9b991e884eae81aa7393f9701b7b7b85e.zip | |
Merge pull request #17932 from zeertzjq/vim-8.1.2145
vim-patch:8.1.{2145,2159,2165,2167,2333,2346,2350},8.2.{0839,0851,0855,0867,0916,0919,2084,2728,3595,4504,4819,4824,4827,4828,4829,4833,4837}
Diffstat (limited to 'src/nvim/testdir/test_mapping.vim')
| -rw-r--r-- | src/nvim/testdir/test_mapping.vim | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index a9500f8f77..6bb8d82021 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -62,7 +62,7 @@ func Test_map_ctrl_c_insert() inoremap <c-c> <ctrl-c> cnoremap <c-c> dummy cunmap <c-c> - call feedkeys("GoTEST2: CTRL-C |\<C-C>A|\<Esc>", "xt") + call feedkeys("GoTEST2: CTRL-C |\<*C-C>A|\<Esc>", "xt") call assert_equal('TEST2: CTRL-C |<ctrl-c>A|', getline('$')) unmap! <c-c> set nomodified @@ -71,7 +71,7 @@ endfunc func Test_map_ctrl_c_visual() " mapping of ctrl-c in Visual mode vnoremap <c-c> :<C-u>$put ='vmap works' - call feedkeys("GV\<C-C>\<CR>", "xt") + call feedkeys("GV\<*C-C>\<CR>", "xt") call assert_equal('vmap works', getline('$')) vunmap <c-c> set nomodified @@ -221,7 +221,7 @@ endfunc func Test_map_meta_quotes() imap <M-"> foo - call feedkeys("Go-\<M-\">-\<Esc>", "xt") + call feedkeys("Go-\<*M-\">-\<Esc>", "xt") call assert_equal("-foo-", getline('$')) set nomodified iunmap <M-"> @@ -429,6 +429,28 @@ func Test_error_in_map_expr() exe buf .. 'bwipe!' endfunc +func Test_list_mappings() + " Remove default mappings + imapclear + + " reset 'isident' to check it isn't used + set isident= + inoremap <C-m> CtrlM + inoremap <A-S> AltS + inoremap <S-/> ShiftSlash + set isident& + call assert_equal([ + \ 'i <S-/> * ShiftSlash', + \ 'i <M-S> * AltS', + \ 'i <C-M> * CtrlM', + \], execute('imap')->trim()->split("\n")) + iunmap <C-M> + iunmap <A-S> + call assert_equal(['i <S-/> * ShiftSlash'], execute('imap')->trim()->split("\n")) + iunmap <S-/> + call assert_equal(['No mapping found'], execute('imap')->trim()->split("\n")) +endfunc + func Test_expr_map_gets_cursor() new call setline(1, ['one', 'some w!rd']) @@ -739,4 +761,20 @@ func Test_mouse_drag_insert_map() set mouse& endfunc +func Test_unmap_simplifiable() + map <C-I> foo + map <Tab> bar + call assert_equal('foo', maparg('<C-I>')) + call assert_equal('bar', maparg('<Tab>')) + unmap <C-I> + call assert_equal('', maparg('<C-I>')) + call assert_equal('bar', maparg('<Tab>')) + unmap <Tab> + + map <C-I> foo + unmap <Tab> + " This should not error + unmap <C-I> +endfunc + " vim: shiftwidth=2 sts=2 expandtab |