Indent or comment several text lines with vi

vim

Solution

here is another way.

- block lines with `ctrl+v`

- Insert comment sign (`//`) with `I`

- escape with ESC

the key typing is

`ctrl+v` → `jjjj` → `I` → `//` → ESC

Problem

can vim or vim be used to comment or indent at the same time a number of lines? For instance: ``` for item in Lista: ind = int(floor(1.0*(item-lmin)/width)) if ind==nintervals: ind=ind-1 print item,ind ``` comment it to: ``` #for item in Lista: #ind = int(floor(1.0*(item-lmin)/width)) #if ind==nintervals: #ind=ind-1 #print item,ind ``` or indent it to: ``` for item in Lista: ind = int(floor(1.0*(item-lmin)/width)) if ind==nintervals: ind=ind-1 print item,ind ``` P.D. Is relevant the difference between VI and VIM?

Original source

Related problems