Your ads will be inserted here by
Easy AdSense.
Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.
One minor pet peeve I had with Vim has been resolved by this neat little trick. Commenting out multiple lines in Python has always been somewhat of a chore for me in Vim. Thankfully, it is actually quite easy:
Hit Ctrl+VSelect the lines you want to comment out (don’t use the mouse for that)Hit “0″ + “I” (capital i) to write simultaneously at the beginning of the selected linestype “#”Hit “ESC”
Update: it’s actually even easier (thank you to Tobi for pointing out this most elegant use case of search and replace in Vim):
- Hit Shift+V to select the lines you want to comment out.
- Enter “:s/^/#/g” to search and “replace” (in this case insert) # at the linestart.
Job’s done. One very neat little trick.
Leave a Reply