Re:Neovim 0.5 is overpowering
by ponyous on Wednesday May 26, 2021 @01:32PM
(#27293531)
I can never remember what all those different maps do: ':map', ':map!', ':nmap', ':vmap', ':imap', ':cmap', ':smap', ':xmap', ':omap', ':lmap', etc. do. There are bunch of questions on StackOverflow about different mapping options so I wouldn't say it's intuitive at all.
[ Parent
| on HN ]
The differences that actually matter are self explanatory: map is for all modes, imap for insert mode, nmap for normal mode and vmap for visual mode (& tmap for terminal mode in NeoVim). The rest can be safely ignored as far as I can tell.
Little confession: I have no idea what e.g. the difference between "nmap" and "nnoremap" is. But after years of randomly mixing them in hundreds of bindings without a noticeable difference it doesn't seem to matter. Just use map, nmap, imap and vmap, avoid duplicates and everything will be fine imho.
Re:Neovim 0.5 is overpowering
by Omni5cience on Wednesday May 26, 2021 @03:01PM
(#27294666)
You're right, for most simple use cases it doesn't matter. But I once spent an hour on a weird bug that turned out to just be some plugin applying a map that I didn't know about and that I didn't know about map expansion. So I might be biased, but I think a loose understanding is helpful.
The default behavior is to recursively expand and apply your mappings and "noremap" disables this recursion. For example if you do something like
:map j k
:map q j
:noremap w j
q is expanded to k, but w is expanded to jThanks for this example, now I get it. It never really clicked for me when I read explanations on SO etc.
Re:Neovim 0.5 is overpowering
by apocolyps6 on Wednesday May 26, 2021 @03:05PM
(#27294714)
nnoremap is "non-recursive remap" since I think its possible to chain nmaps (`nmap A B, nmap B C` will map A to C)