Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I have vim do multiline edit?

Tags:

vim

I merged a python file using vimdiff, and the result has something like this:

def code():
  line 1
  line 2
   line 3
   line 4
   ...
   line n

In this state, the indentation is inconsistent. How could I remove all the spaces in front of the lines? I tried in Visual mode, but it's selecting the whole line. Does vim have a multiline edit? Notepad++ allows this with Alt-Shift.

like image 544
Geo Avatar asked Jun 20 '11 07:06

Geo


Video Answer


1 Answers

Ctrl-V to select blocks.

Or, to remove all white-space at the start of all lines in the file:

:%s/^\s\+
like image 109
searlea Avatar answered Sep 21 '22 10:09

searlea