Skip to main content
2 of 7
Corrected the question.
JHK
  • 775
  • 8
  • 12

How to comment out a set of lines which are selected in visual mode?

How do I comment out multiple in visual mode selected lines? How do I make it language specific?

For example, if the first 4 lines are selected:

def foo(a,b):
    for each in (a,b):
        print each
    return a+b
print "2"

The operation of a command/macro should result in this (in python):

#def foo(a,b):
#    for each in (a,b):
#        print each
#    return a+b
print "2"
JHK
  • 775
  • 8
  • 12