0

Some of my Vim mappings have stopped working, even though :map <keys> shows that the mapping has been registered.

One example is map <S-CR> O<Esc> in my .vimrc, which does not work even if I remove the preceding map <CR> o<Esc> entry. If the previous entry is present, both <CR> and <S-CR> do the same thing.

I have tried removing all Vim packages and reinstalling from source, but it still doesn't work. What are some general trobuleshooting tips that might be of help?

  • Are you sure you use vim and /usr/bin/vi is not a symlink to elsewhere? – UVV Dec 15 '14 at 13:06
  • 1
    Have you changed terminals or previously used GVIM? Not all key combinations are handled in terminal Vim; <S-CR> and <C-CR> mostly don't work there. – Ingo Karkat Dec 15 '14 at 13:14
  • 1
    type :map to see what vim thinks it has got mapped – zzapper Dec 15 '14 at 13:25
  • How u removed the vim? You need to remove it completely I mean the configuration files also.You can use purge to remove it completely. sudo apt-get purge vim and reinstall it. – Thushi Dec 15 '14 at 13:41
  • @zzapper :map returns what I expect it to. – Soham Chowdhury Dec 15 '14 at 17:42
0

Using gvim fixes the <S-CR> issue, but other mappings still aren't working, like ,ev (mentioned in the comments).

0

One day, I noticed that some of my mappings had stopped working without any visible reasons. Exactly as Soham did.

In short, it seems that our lovely Vim has a very weird side effect. In my case, adding the » symbol to the string of the langmap option incomprehensibly ruins some of the mappings for other keys and symbols. Wherein, the output of the :map command tells that all must be OK. Yes, in some cases, such as Shift-Tab, the terminal does not pass over the signal, but it’s not the case we’re talking about.

If anyone, as Soham or me, is having the trouble, try to start your investigation from the langmap option. And don’t think, please, that there is any visible connection between the symbols in your langmap and the symbols and keys that stopped working.

The details.

Knowing about the terminal behaviour, in order to have more “handles” for Vim, I’ve remapped some of the keyboard mappings via the xkb technology. In particular, I have the Escape signal on the Tab key. On the fifth level of that key (xkb terminology) I have the ↻ symbol which is mapped in Vim to the Ctrl-R command. Then, I have the ” symbol on the x key (on the third level) when I‘m working with a Latin set, and the » symbol on the same key when I‘m working with a Cyrillic set.

So, my langmap is:

    set lmap=
    set lmap+=йцукенгшщзхъ;qwertyuiop'\"
    set lmap+=фывапролджэ;asdfghjkl_=
    set lmap+=ячсмитьбю;zxcvbnm‘’
    set lmap+=ЙЦУКЕНГШЩЗХЪ;QWERTYUIOP'\"
    set lmap+=ФЫВАПРОЛДЖЭ;ASDFGHJKL_=
    set lmap+=ЯЧСМИТЬБЮ;ZXCVBNM‘’
    set lmap+=«»;“”

The » symbol in the last string (actually located at the x key) ruins the mapping for the ↻ symbol on the Tab key. Yes! It’s very interesting! So, deleting the mapping for the » symbol puts Vim to the right condition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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