Answers for "vim comment multiple lines"

2

vim replace multiple lines

# Replace all instances of foo with bar
:%s/foo/bar/g

# Replace all instances of foo in lines 6 to 10 inclusive with bar
:6,10s/foo/bar/g
Posted by: Guest on October-02-2020
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
0

how to comment multiple lines in vi

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

# To uncomment
'<,'>s!^//!!
Posted by: Guest on August-20-2021

Code answers related to "vim comment multiple lines"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language