Commenting and uncommenting lines

How would I use vim to quickly commend and uncomment lines?

It just needs to add # to X number of lines from the current line.

The uncomment I could do with regexp (s/^#//), but if there is a better way I'd love to hear it.

Who is Participating?
ozoConnect With a Mentor Commented:
bayesianmindAuthor Commented:
Thanks that does the job but it adds a large yellow bar to the left side of the window.. what is that and how do I get rid of it?
TalmashConnect With a Mentor Commented:
2 options to remove the yellow mark:

1: use ma and mb instead of . and .+5
   mark 1st line with ma
  mark last line with mb (use down arrow to navigate)

2. exit and open again
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.