0

I have this mapping in my ~/.config/nvim/mappings.vim (it's included with source from the init.vim file):

noremap <S-k> 5gk
vnoremap <S-k> 5gk

I went through a part of the vim manuals and found this entry: :h find-manpage. I was always wondering why the help page popped, if I pressed Shift-k and now there's the reason! But why does the default K binding still opens the manual page although I used noremap?

3
  • 3
    Shift-k is K. I don’t completely know why you’re mapping isn’t taking precedence, but you could just remap K directly. (Aside: I like K’s behavior, so I don’t recommend getting rid of it! keywordprg can be quite nice, and it’s a shame that it’s so difficult to make some languages work with it.)
    – D. Ben Knoble
    Oct 16 '20 at 13:28
  • 2
    Welcome to Vi and Vim!
    – filbranden
    Oct 16 '20 at 16:25
  • 1
    @D.BenKnoble I'm sorry for answering very late. Could you please write your suggestion just remap K directly as an answer so I can tick this question as answered?
    – TornaxO7
    Feb 25 '21 at 19:24
2

If you need a mapping like this, I would just remap K directly:

noremap K 5gk

(Personally, I like K's keywordprg usage, and it's a shame so many languages are hard to use it with. So I recommend not doing this, but YMMV.)

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.