Monday, November 24, 2008

vi - remove all leading whitespace in a line

shift-v (to work in visual mode)

select text to use

:'<,'>s/\v^\s+//

'<,'> means "operate only on selected text"
s/ means "start of a line"
\v^ means "treat all text as magic" - i forget why
\s means "all space characters"
+ means "for multiple instances"
/ means "replace with everything until the next /"

hooray!

(note to self and anyone else who uses vi for html editings)

No comments: