Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
859 views
in Technique[技术] by (71.8m points)

vim - NERD commenter : How to comment out a range

I am using NERD commenter

Let's say that I want to comment out lines from 78 to 172. This is what I do. I calculate the difference. That is 94. put my cursor on line 78 and then I do: 94 , c space

In this way I comment 94 lines starting from line number 78.

I don't like the calculation that I need to do. I was hoping to pass a range something like

78,172 to comment the code from line 78 to 172. Am I missing something.

Looking at the popularity of this plugin, it seems there must be a better way to comment and uncomment.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'd do (in visual mode) :78v172G to select and highlight lines 78 to 172, then just ,c<space>.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...