Well, I have had these cases before. I sometimes did unmap, but I don't want to do this for every case.

I define

nnoremap <nowait> <leader>h :wincmd h<CR>

But it does wait for me typing longer normal commands after the \h. Is it because they are defined afterwards?

map \h returns the following:

n  \hp          @<Plug>(GitGutterPreviewHunk)
n  \hu          @<Plug>(GitGutterUndoHunk)
n  \hs          @<Plug>(GitGutterStageHunk)
x  \hs          @<Plug>(GitGutterStageHunk)
n  \h          * :wincmd h<CR>

What is the meaning of the * btw?


<nowait> is intended for cases where a global mapping \hs (for example) exists and you would like to create a buffer-local mapping \h (for example).

I suppose then the following would work:

autocmd FileType * nnoremap <nowait> <buffer> <leader>h :wincmd h<CR>

In :map, * means created with nnoremap etc, i.e., "not re-mappable."


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.