Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #86 - Helps undo 1 line when entered many

Created: July 9, 2001 9:38 Complexity: basic Author: Stepan Koltsov <yozh--AT--mx1.ru> Version: 5.7 Karma: 3/6 Imported from: Tip#86

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


If U add this line to .vimrc:

inoremap <Return> <Return>^O^[

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

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

Comments

nice tip. but U definitely should improve your English :)

rnd--AT--softhome.net , July 9, 2001 14:26


Thanks for advice (about English :) Anywhen I'll learn it :)

I saw 1 bug of this tip: autoindent don't work. How to correct this?

Yozh.

yozh--AT--mx1.ru , July 13, 2001 11:17


Sorry my English again :)

First idea -- write:

inoremap <return> <return>a^Ox

it works, but it looks not nice :( I know vim too bad...

Yozh.

yozh--AT--mx1.ru , July 13, 2001 11:22


And Yozh solution is not causes a beep

kgergely--AT--mcl.hu , January 9, 2002 6:36


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

drennalls--AT--gmail.com , November 18, 2004 10:36


Advertisement