1

I made the following mapping in my vimrc:

cnoremap <Leader><Leader> <Esc><Esc>i

It works perfectly if I was in any mode before entering the COMMAND LINE mode, except if I was in (insert) SELECT (but it works fine in SELECT). In this case, the cursor goes back one position more on the left as it was initially.

Of course, I could move it back with <Right>, but then it will be one position too much on the right for all the other situations that used to work fine. And since the mode() function does not distinguish (insert) SELECT from SELECT, I don't know either how to distinguish the mode I was originally in.

Is there a solution?

Axel
  • 361
  • 2
  • 11
  • have a look here: https://stackoverflow.com/questions/2295410/prevent-cursor-from-moving-back-one-character-on-insert-mode-exit here: https://unix.stackexchange.com/questions/11402/why-does-esc-move-the-cursor-back-in-vim/11403#11403 or here: https://stackoverflow.com/questions/3676388/cursor-positioning-when-entering-insert-mode – Doktor OSwaldo Oct 26 '17 at 09:21
  • Thank you Doktor OSwaldo. This is very helpful! – Axel Oct 26 '17 at 15:47

0 Answers0