aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir/setup.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-14 16:49:03 +0800
committerGitHub <noreply@github.com>2024-07-14 16:49:03 +0800
commitf0eb855607f82026d8a32dffb3cdf59212694538 (patch)
treeb4532a00a60eefe2aee77e7bdbf7ef1eb769c9da /test/old/testdir/setup.vim
parent49ba36becd0bbf1052802b846f418aee673b28a5 (diff)
parentc8401515cdaad20220e30f5a0c39ddb7bae77f5e (diff)
downloadrneovim-f0eb855607f82026d8a32dffb3cdf59212694538.tar.gz
rneovim-f0eb855607f82026d8a32dffb3cdf59212694538.tar.bz2
rneovim-f0eb855607f82026d8a32dffb3cdf59212694538.zip
Merge pull request #29696 from zeertzjq/vim-9.1.0573
vim-patch:9.1.{0573,0574,0582}
Diffstat (limited to 'test/old/testdir/setup.vim')
-rw-r--r--test/old/testdir/setup.vim19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim
index 2e4085ce03..6f400c5e32 100644
--- a/test/old/testdir/setup.vim
+++ b/test/old/testdir/setup.vim
@@ -32,8 +32,8 @@ if exists('s:did_load')
endif
if g:testname !~ 'test_mapping.vim$'
" Make "Q" switch to Ex mode.
- " This does not work for all tests.
- nnoremap Q gQ
+ " This does not work for all tests as Nvim only supports Vim Ex mode.
+ nnoremap Q gQ<Cmd>call<SID>ExStart()<CR>
endif
endif
@@ -45,6 +45,21 @@ if exists('s:did_load')
endif
let s:did_load = 1
+func s:ExStart()
+ call feedkeys($"\<Cmd>call{expand('<SID>')}ExMayEnd()\<CR>")
+endfunc
+
+func s:ExMayEnd()
+ " When :normal runs out of characters in Vim, the behavior is different in
+ " normal Ex mode vs. Vim Ex mode.
+ " - In normal Ex mode, "\n" is used.
+ " - In Vim Ex mode, Ctrl-C is used.
+ " Nvim only supports Vim Ex mode, so emulate the normal Ex mode behavior.
+ if state('m') == '' && mode(1) == 'cv' && getcharstr(1) == "\<C-C>"
+ call feedkeys("\n")
+ endif
+endfunc
+
" Clear Nvim default user commands, mappings and menus.
comclear
mapclear