3

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?

1 Answers1

5

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.

Ralf
  • 9,197
  • 1
  • 11
  • 30