DEV Community

Discussion on: How to Debug Key Mappings in Vim

Collapse
 
brandonwallace profile image
brandon_wallace

Nice article Serhat.

The *map command are recursive which can cause issues with plugins that map to the same keys.

Here is an example:

nmap x j        # Your mapping
nnoremap j x    # Plugin mapping
Enter fullscreen mode Exit fullscreen mode

You want x to move the cursor down a line but the plugin maps j to delete one character.
Now when you press x to move down one line you end up deleting a character.

nnoremap x j    # Your mapping
nnoremap j x    # Plugin mapping
Enter fullscreen mode Exit fullscreen mode

Now both mappings work.

It is much better to use nnoremap, inoremap, vnoremap to map your keys.