1

I basically have the same problem as described here. In my vimrc I have

nnoremap <buffer> <silent> k gk
nnoremap <buffer> <silent> j gj
nnoremap <buffer> <silent> 0 g0
nnoremap <buffer> <silent> $ g$

This setting however gets somehow overwritten and I have to use :source $MYVIMRC to get it to work again. The answers of the question above suggest that a plugin might overwrite my setting and to check that using :verbose :map, which brings me to my question.

I can't find the mapping for any of my navigation keys. I see mappings for more complex key combinations like [[ by plugins, my own mappings for navigating windows or things that seem like variables to me like <Plug>Tex_LeftRight (my guess that this are variables comes from here). However I cannot find any mappings for the hjkl keys or other keys I am mapping.

Are those mapped by those <Plug> mappings? If so, how can I resolve these? If not, how can I find out their mappings?

3

You defined the mappings as buffer-local. So the mappings are only available in the buffer active at the time of executing the mapping commands.

In your vimrc use:

nnoremap k gk
nnoremap j gj
nnoremap 0 g0
nnoremap $ g$

I also removed <silence>. The <silence> is only needed if you want to suppress some output, but I don't see the need here.

To check that a mapping is active, just execute :map to see all mappings, but that produces lots of output (as you already know). So executing :map k will just show the mapping for k. The output would be:

n  k           * gk
  • n means, it is a normal mode mapping.
  • k is the char mapped
  • * means that it is defined noremap
  • gk is the value k is mapped to

See :help map-listing for details.

  • Thanks, that solved my main problem. But how would I be able to see these mappings? – Jerome Reinländer Mar 9 at 13:21
  • 1
    @JeromeReinländer Updated. – Ralf Mar 9 at 14:05
  • ... and accepted. Thanks again for going the extra mile to not only answer my question but also helping with the underlying issue. I can verify that both parts of you answer work. – Jerome Reinländer Mar 9 at 14:11

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.