Answers for "how to comment lines in vim"

1

vim comment out mutiple lines

# To comment
Press ESC
hit V
Move the cursor until desired lines to comment
hit :
'<,'>s/^/#/g

# To uncomment
Do the same, but command is:
'<,'>s/^#//g

# '<,'> indicates the range you've selected with VISUAL MODE.
Posted by: Guest on August-03-2021
-1

how to comment a whole file in vim?

# To comment a block
:66,70s/^/#/g

# To uncomment a block
:66,70s/^#//g
Posted by: Guest on July-23-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language