neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit f6a6db3e248dd6360dbd55574321ddc216848c13
parent df666521ac4dd338b59082b1100a4673acde9e64
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri, 17 Feb 2023 07:59:22 +0800

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>

Diffstat:
Msrc/nvim/testdir/setup.vim | 8+++++---
Msrc/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 @@ -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 @@ -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')