vim: delete the first 2 spaces for multiple lines
Solution 1:
- Enter visual block mode with
Ctrl-V
(orCtrl-Q
if you useCtrl-V
for paste); - Select the area to delete with the arrows;
- Then press
d
to delete the selected area. - Press
Esc
Solution 2:
Some more options. You can decided which is the "easiest way".
Remove the first 2 characters of every line:
:%normal 2x
Remove first 2 characters of every line, only if they're spaces:
:%s/^ /
Note that the last slash is optional, and is only here so that you can see the two spaces. Without the slash, it's only 7 characters, including the :
.
Move indentation to left for every line:
:%normal <<