vimrc key mapping not working after the Esc key

357 views Asked by At
map <Alt>q <Esc>la

This line in my vimrc seems not working after the Esc key. It do exits the insert mode but doesn't enter insert mode again. I also tried

inoremap <Alt>q <Esc>la
map <Alt>q <Esc><Ctrl-A>
map <Alt>q <Esc><Ctrl>A

Basically I want to have something within the normal typing position to have the same effect as key. Say

(i>5[cursor]) 
->
(i>5)[cursor]

Solution:

I figured out the problem. Its cuz my terminal doesn't properly recognize alt as the alt, instead as a system level alt somehow. see

Alt key shortcuts not working on gnome terminal with Vim

1

There are 1 answers

1
melpomene On BEST ANSWER

As far as I can see there are two problems:

  1. <Alt> isn't a thing. If you want to map Alt+q, that's <M-q>.
  2. :map doesn't apply to insert mode.

You haven't explained what you're trying to do, so I can't tell you what to do instead.