diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-03-03 21:59:28 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-03-03 22:41:09 +0800 |
| commit | e8107f07486ce9dffdc020baf12836e55bf90ce5 (patch) | |
| tree | 1c31b0eddbfe3c87c644a8c676a1c24a334ce65f /src/nvim/testdir/test_mapping.vim | |
| parent | 7211d8ef21cd93365c5f0582c5a0115e84c011ce (diff) | |
| download | rneovim-e8107f07486ce9dffdc020baf12836e55bf90ce5.tar.gz rneovim-e8107f07486ce9dffdc020baf12836e55bf90ce5.tar.bz2 rneovim-e8107f07486ce9dffdc020baf12836e55bf90ce5.zip | |
vim-patch:8.2.4498: using <Plug> with "noremap" does not work
Problem: Using <Plug> with "noremap" does not work.
Solution: Always remap <Plug>. (closes vim/vim#9879, closes vim/vim#9789)
https://github.com/vim/vim/commit/1fc34225acbee5ddca2b9ec3f82b3014d385b7f8
Diffstat (limited to 'src/nvim/testdir/test_mapping.vim')
| -rw-r--r-- | src/nvim/testdir/test_mapping.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 1080a3c85b..98440ccdd7 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -646,4 +646,34 @@ func Test_abbreviate_multi_byte() bwipe! endfunc +" Test for <Plug> always being mapped, even when used with "noremap". +func Test_plug_remap() + let g:foo = 0 + nnoremap <Plug>(Increase_x) <Cmd>let g:foo += 1<CR> + nmap <F2> <Plug>(Increase_x) + nnoremap <F3> <Plug>(Increase_x) + call feedkeys("\<F2>", 'xt') + call assert_equal(1, g:foo) + call feedkeys("\<F3>", 'xt') + call assert_equal(2, g:foo) + nnoremap x <Nop> + nmap <F4> x<Plug>(Increase_x)x + nnoremap <F5> x<Plug>(Increase_x)x + call setline(1, 'Some text') + normal! gg$ + call feedkeys("\<F4>", 'xt') + call assert_equal(3, g:foo) + call assert_equal('Some text', getline(1)) + call feedkeys("\<F5>", 'xt') + call assert_equal(4, g:foo) + call assert_equal('Some te', getline(1)) + nunmap <Plug>(Increase_x) + nunmap <F2> + nunmap <F3> + nunmap <F4> + nunmap <F5> + unlet g:foo + %bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |