diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-17 07:59:22 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-17 08:47:44 +0800 |
commit | f6a6db3e248dd6360dbd55574321ddc216848c13 (patch) | |
tree | 6b8f0cecd8f2ed13c8db671ff79d11e9b84938c7 | |
parent | df666521ac4dd338b59082b1100a4673acde9e64 (diff) | |
download | rneovim-f6a6db3e248dd6360dbd55574321ddc216848c13.tar.gz rneovim-f6a6db3e248dd6360dbd55574321ddc216848c13.tar.bz2 rneovim-f6a6db3e248dd6360dbd55574321ddc216848c13.zip |
vim-patch:8.2.0148: mapping related function in wrong source file
Problem: Mapping related function in wrong source file.
Solution: Move the function. Add a few more test cases. (Yegappan
Lakshmanan, closes vim/vim#5528)
https://github.com/vim/vim/commit/7f51bbe0d19f1f0cb0321326f45a17b4f5155f89
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/testdir/setup.vim | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_mapping.vim | 33 |
2 files changed, 38 insertions, 3 deletions
diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim index f895287469..25ac2d1239 100644 --- a/src/nvim/testdir/setup.vim +++ b/src/nvim/testdir/setup.vim @@ -26,9 +26,11 @@ if exists('s:did_load') set viewoptions& set viewoptions+=options set switchbuf= - " Make "Q" switch to Ex mode. - " This does not work for all tests. - nnoremap Q gQ + if g:testname !~ 'test_mapping.vim$' + " Make "Q" switch to Ex mode. + " This does not work for all tests. + nnoremap Q gQ + endif endif " Common preparations for running tests. diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 5c5a65d4ca..6cf19306ec 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -934,6 +934,39 @@ 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 + " Nvim: no "<" flag in 'cpoptions'. + " 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 + func Test_map_cmdkey_redo() func SelectDash() call search('^---\n\zs', 'bcW') |