Skip to content

Conversation

@mkomitee
Copy link
Contributor

@mkomitee mkomitee commented Feb 4, 2013

ctrl-v in vim activates visual block mode. visual block mode can be used to
insert a comment character, but is not itself a comment toggle.

ctrl-v in vim activates visual block mode. visual block mode can be used to
insert a comment character, but is not itself a comment toggle.
@ghost
Copy link

ghost commented Feb 13, 2013

The statement isn't completely incorrect, but is slightly misleading and could be improved. See this Stack Overflow question, this answer in particular:

For those tasks I use most of the time block selection.

Put your cursor on the first # character, press Ctrl-q, and go down until the last commented line and press x, that will delete all the # characters vertically.

For commenting a block of text is almost the same, go to the first line you want to comment, press Ctrlq, then select until the last line, and press I#Esc, that will insert a # character on all selected lines.

@sigmavirus24
Copy link
Contributor

@Kuyan but it doesn't toggle commenting a line. You can't move to a line press ^-v and have the line auto-commented. It is a visual block trigger though through which one of the things you can do is insert characters, which in python and ruby's case could be an octothorpe.

@mkomitee
Copy link
Contributor Author

The statement is incorrect. ctrl-v is not a "comment/uncomment" toggle in vim. Regardless, this is a python guide, and there's really no need to include this even if it were accurate.

@sigmavirus24
Copy link
Contributor

@mkomitee in case my comment wasn't explicit enough, I'm +1 for this PR

@ghost
Copy link

ghost commented Feb 14, 2013

@mkomitee @sigmavirus24 You're right - in that case, this pull request has my 👍.

@mkomitee
Copy link
Contributor Author

Excellent.

Off-topic: @sigmavirus24, do you ever have to sleep like the rest of us?

@sigmavirus24
Copy link
Contributor

@mkomitee what is this sleep you speak of?

@orientalperil
Copy link

This thread was a fun read. Thumbs up.

kennethreitz pushed a commit that referenced this pull request Mar 6, 2013
ctrl-v is not a comment toggle in vim
@kennethreitz kennethreitz merged commit b3146b5 into realpython:master Mar 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants