0

In Vim, I am ttempting the following remaps:

nnoremap <A-1> :make<CR>
inoremap <A-1> <Esc>:make<CR>i

Basically, I want to remap alt+1 to :make. However, this remap fails and I can't see why.

The map

nnoremap q :make<CR>

works. Why is that? Isn't < A-1> the proper way to describe alt+1?

Edit: I am using terminal vim.

1 Answer 1

0

<A-1> is a proper way to describe <M-1>, but I doubt that your terminal emulator sends it when you press Alt-1. Most probably it sends <esc>1, so you can map:

:nnoremap <esc>1 :make<CR>
:inoremap <esc>1 <C-o>:make<CR>
7
  • Nope, doesn't work. alt-1 does nothing.
    – morphheus
    Sep 3, 2014 at 22:28
  • @morphheus Well, show what your term sends when you press Alt-1 though: in Vim input mode: <C-v><ALT-1>. Sep 3, 2014 at 22:30
  • nothing! I had tried that too. other commands (such as ctrl-c) show up, but no alt commands.
    – morphheus
    Sep 3, 2014 at 22:51
  • @morphheus Hmm... What terminal emulator do you use? Sep 3, 2014 at 22:52
  • gnome terminal. (i'm running arch linux w/ gnome)
    – morphheus
    Sep 3, 2014 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .