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?
vim-multiline-comment.md For commenting a block of text is almost the same: First, go to the first line you want to comment, press Ctrl``V , and select until the last line. Second, press Shift``I``#``Esc (then give it a second), and it will insert a # character on all selected lines.
To tab or add the indentation at multiple lines, try “shift+dot” i.e., “.” Shortcut once. You will see it will add an indentation of one character at each selected line from the start. If you want to add indentation without stopping, then you have to try the “.” Key from the keyword after using “shift+.”.
here is another way.
ctrl+v
//
) with I
the key typing is
ctrl+v
→ jjjj
→ I
→ //
→ ESC
To comment, press a capital V to enter VISUAL LINE mode, select all lines, then press : to enter command mode and use the command (note that VIM already include the '<,'>
marks for you):
:'<,'>s/^/#/
If you prefer hash marks near the text, and not near the left margin, the command is:
:'<,'>s/^\(\s*\)/\1#/
To indent, select the block the same, then type >
to indent, <
to unindent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With