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>x
in 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.<esc>
, but since I am gonna use these mappings withAlt
mapping with<M-..>
seems more straightforward. So I would like to know if it is possible and how Vim folks usually deal withAlt
-mappingseightbitinput
andmetasendsescape
unset in your terminal. Enabling the former should allow mappings like<A-x>
.