From f291a0339c186cf6eb83174e88029555b3c2631a Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Sat, 12 Mar 2022 17:56:53 -0700 Subject: [PATCH] fix: use normal! in default mapping (#17695) --- runtime/doc/vim_diff.txt | 2 +- src/nvim/getchar.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 5ea6a9c5dd..7f944bbfe6 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -84,7 +84,7 @@ Nvim creates the following default mappings at |startup|. You can disable any of these in your config by simply removing the mapping, e.g. ":unmap Y". > nnoremap Y y$ - nnoremap nohlsearchdiffupdate + nnoremap nohlsearchdiffupdatenormal! inoremap u inoremap u < diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 299456f688..3ec5d24753 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -842,7 +842,10 @@ static void init_typebuf(void) void init_default_mappings(void) { add_map((char_u *)"Y y$", NORMAL, true); - add_map((char_u *)" nohlsearchdiffupdate", NORMAL, true); + + // Use normal! to prevent inserting raw when using i_ + // See https://github.com/neovim/neovim/issues/17473 + add_map((char_u *)" nohlsearchdiffupdatenormal! ", NORMAL, true); add_map((char_u *)" u", INSERT, true); add_map((char_u *)" u", INSERT, true); }