Do Vim users use Alt key for mappings? If yes, how exactly?
As it is known, there are 2 common ways of handling Alt key in CLI software: either <Esc>-prefix or 8-bit. It seems like Vim chooses the later way while a lot of other CLI software(e.g. Neovim, bash, tmux) chooses the former one.
From intro.txt:
4. "<key>" means the special key typed. This is the notation explained in
the table above. A few examples:
<Esc> Escape key
...
<M-a> Meta- a ('a' with bit 8 set)
<M-A> Meta- A ('A' with bit 8 set)
Given my terminal emulator is configured to emit <Esc>-prefix(and it is proven by showkey -a), does it mean that instead of nnoremap <M-y> :echo hello<cr> I should map nnoremap <Esc>y: echo hello<cr>? Or there is some option which I missed or trick that I don't know about?
<esc>xin your case. In your terminal, with<c-v><a-x>, you will be able to check the sequence that is received. That's what you want in your map in vim. The^[character represents a<esc>, I recommend using the latter. – Biggybi Nov 12 '21 at 14:43<esc>, but since I am gonna use these mappings withAltmapping with<M-..>seems more straightforward. So I would like to know if it is possible and how Vim folks usually deal withAlt-mappings – vatosarmat Nov 12 '21 at 14:51eightbitinputandmetasendsescapeunset in your terminal. Enabling the former should allow mappings like<A-x>. – Biggybi Nov 12 '21 at 14:55