I have a number of alt key re-mappings in my Vim .vimrc that I copied over to my Neovim init.vim file. The single alt key mappings work fine but any compound re-mappings are not working. It seems like NeoVim is ignoring the Alt on the second keystroke.

For example:

" This works in both Vim and NeoVim
map <esc>x :qall<CR>

" This works in Vim but NeoVim will start the keystroke recorder
map <esc>q<esc>q :qall!<CR>

Is there any way to make this work? I'm using terminator under Linux if that matters.

  • 1
    Welcome to Vim! I'm a bit confused. I see in your mapping <esc>x where your text is mentioning the alt key. In such case I would expect a <M-x> mapping. Could you share the OS you are using together with the exact key combination you try to map? Commented Apr 21, 2023 at 18:40
  • I'm using Ubuntu 20. I want to use the Alt key which in Terminator seems to generate things like ^[x for Atl-x. This works fine in Vim and for single keypresses in NeoVim. Commented Apr 23, 2023 at 10:37
  • I can reproduce the <esc>x behavior on Ubuntu WSL. But unfortunately on my machine the <esc>q<esc>q mapping is working fine. Commented Apr 23, 2023 at 11:04

1 Answer 1


I would try:

map <M-x> :qall<CR>
map <M-q><M-q> :qall!<CR>


  • For command mapping it is recommended to use the <Cmd> modifier
  • Unless good reasons the noremap is recommended over map
noremap <M-x> <Cmd>qall<CR>
noremap <M-q><M-q> <Cmd>qall!<CR>
  • And unless you have good reason to want them in multiple modes, nnoremap (two ns)
    – D. Ben Knoble
    Commented Apr 22, 2023 at 1:49
  • 1
    This worked. Thanks a lot. Commented Apr 23, 2023 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.