VsVim icon indicating copy to clipboard operation
VsVim copied to clipboard

Remapped ESC not working in VsVim

Open Flawe opened this issue 3 years ago • 3 comments

I have ESC remapped in VIM to be able to clear search highlights like this:

augroup escape_mapping
  autocmd!
  autocmd InsertEnter * call s:setupEscapeMap()
augroup END

function! s:setupEscapeMap()
  nnoremap <Esc> :noh<CR><Esc>
endfunction

This isn't working with VsVim 2.8.0.0 and VS 16.10.4.

Any chance there's a way to rework this setup to function in VsVim as well?

Flawe avatar Aug 13 '21 16:08 Flawe

@Flawe This is the mapping I use in my _vsvimrc:

nnoremap <esc> :noh<CR><esc> without wrapping it in a function and it works as expected.

gwojan avatar Aug 13 '21 23:08 gwojan

Thanks @gwojan, that does indeed work, but it breaks vanilla Vim, see this thread:

https://vi.stackexchange.com/questions/2614/why-does-this-esc-normal-mode-mapping-affect-startup

I was just curious if there was a way to use a single vimrc for both environments.

Flawe avatar Aug 14 '21 13:08 Flawe

@Flawe interesting... I think I might have encountered that a while back and never really put two and two together. That being said, I almost never use vanilla vim or neovim.

Thanks for the heads-up -- I'll be watching for this now. 😃

gwojan avatar Aug 14 '21 14:08 gwojan