From 5a111c1b02bbfbc2b42df11d7205153be0893dff Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 16 Aug 2021 06:24:59 +0200 Subject: feat(defaults): map Y to y$ #13268 rationale: - consistent with D and Y - long recommended by Vim's own ":help Y" close #13268 close #416 ref #6289 --- src/nvim/main.c | 3 +++ src/nvim/normal.c | 5 +++++ src/nvim/testdir/setup.vim | 1 + src/nvim/testdir/test_autocmd.vim | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/nvim') diff --git a/src/nvim/main.c b/src/nvim/main.c index 252aa81825..2cdf01b146 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -314,6 +314,9 @@ int main(int argc, char **argv) init_highlight(true, false); // Default highlight groups. TIME_MSG("init highlight"); + init_default_mappings(); // Default mappings. + TIME_MSG("init default mappings"); + // Set the break level after the terminal is initialized. debug_break_level = params.use_debug_break_level; diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 2a530db934..a92376a3ec 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -397,6 +397,11 @@ void init_normal_cmds(void) nv_max_linear = i - 1; } +void init_default_mappings(void) +{ + add_map((char_u *)"Y y$", NORMAL | VISUAL); +} + /* * Search for a command in the commands table. * Returns -1 for invalid command. diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim index fcbc28fdc0..e8f6e74311 100644 --- a/src/nvim/testdir/setup.vim +++ b/src/nvim/testdir/setup.vim @@ -21,6 +21,7 @@ set undodir^=. set wildoptions= set startofline set sessionoptions+=options +unmap Y " Prevent Nvim log from writing to stderr. let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index ad28118f16..c8138e5ca9 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1955,7 +1955,7 @@ func Test_autocmd_sigusr1() let g:sigusr1_passed = 0 au Signal SIGUSR1 let g:sigusr1_passed = 1 - call system('/bin/kill -s usr1 ' . getpid()) + call system('kill -s usr1 ' . getpid()) call WaitForAssert({-> assert_true(g:sigusr1_passed)}) au! Signal -- cgit