Vim Tips Wiki
Advertisement
Tip 86 Printable Monobook Previous Next

created July 9, 2001 · complexity basic · author Stepan Koltsov · version 5.7


When you entered text, you cannot undo only 1 line, for example, when you press "u", all entered in last "insert" text removed.

If you add this line to .vimrc:

inoremap <Return> <Return>^O^[

where "^O" or "^[" is 1 char

"u" will undo (remove) only 1 line.

Comments


First idea -- write:

:inoremap <return> <return>a^Ox

it works, but it looks not nice.


That mapping causes a problem if you break an existing line up, for e.g. if have the following line.

TextOnALine

pressing return in between 'Text' And 'OnALine' will give you..

Text
ananALine

The 'O' gets replaces with the 'a'.

Adding a <Left> seems to work ok for me

inoremap <return> <return>a<Left>^Ox

Advertisement