Saturday, July 21, 2012

Re: esc and cursor position

Am 21.07.2012 09:39, schrieb Anthony Campbell:
> On 20 Jul 2012, Christian Brabandt wrote:
>> Hi sinbad!
>>
>> On Fr, 20 Jul 2012, sinbad wrote:
>>
>>> why does the<esc> takes the cursor a position back.
>>> is there any specific for this ?
>>
>> That is how traditional Vi has always behaved.
>
> This has been discussed before and I think the conclusion was that it is
> a feature, not a bug. But I find it annoying so I have this in my vimrc:
>
> "prevents cursor moving backwards from insert
> inoremap <ESC> <ESC>l

There is a better version:
:ino <Esc> <C-O><C-\><C-N>

(doesn't beep when at EOL; doesn't move when at begin-of-line)


Slightly more radical is:
:ino <Esc> <C-\><C-O><C-\><C-N>

(keeps the cursor after EOL even with empty 'virtualedit')


Since 7.3.489, you can have convenient abbrev expansion:
:ino <Esc> <C-]><C-O><C-\><C-N>

(earlier Vims required to use :imap and inserted ^] when there was no expansion)


(I've used any of these only for a short time)

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment