Vim cursor goes line down when esc mapped to jk
I have
imap jk <C-[>
in my vimrc, but when I use it on the end of line (when cursor is on $ when list is on) cursor goes to beginn开发者_StackOverflow社区ing of next line. How to fix it?
It works normally for me.
I assume interfering mappings or settings.
First you should try
:inoremap jk <C-[>
can you provide more details
- version
- verbose set 1
- map j
- map k
- map jk
I have a hunch it might be the virtualedit
settings or stuff like that interfering
1 get it with
:redir >> ~/file.log
:verbose set
:redir END
I had the same problem and figured out that the described effect appears when you accidentally map
:inoremap jk <Esc> "comment => maped to '<Esc> '
Which would be EscSpace
Or if you have a trailing whitespace in this line. This can be observed by setting
:set list
First hack is:
imap jk <Left><C-[>
But maybe there is better solution?
精彩评论