0
votes

I'm trying to map ALT+m to Esc in Vim, to exit insert mode. I've tried with:

map <A-m> <Esc>

but it is not working as expected (i.e. it exits insert mode, but the next key pressed is ignored). That's because, apart from exiting insert mode, m gets "pressed" or executed as well (i.e. if i remap ALT+j to Esc instead, then apart from exiting insert mode, it will jump to the next line).

Is there any way to map ALT+m to Esc in insert mode without having other side-effects? (avoiding to execute m after exiting insert mode)

Using Fedora 21 (GNU/Linux distribution), with GNOME Terminal 3.14.3 and VIM - Vi IMproved 7.4.

1
Have a look at this post. The keyboard combination CTRL + C seems to be special in some way in Vim.Tim Biegeleisen
@TimBiegeleisen: the result would be the same when using <ESC> instead.Peque
It works for me under windows, but I can reproduce the behavior you describe under debian.Antony Hatchkins
Under linux, alt-m ends up being escape-m when it comes to the OS. You don't need to map <A-m> to anything to get the effect you describe ;) Alt-m is already <escape> followed by <m>.Antony Hatchkins
:h :map-alt-keys could helpAntony Hatchkins

1 Answers

2
votes