How-to : Comment multiple lines using vi



Just a quick note about vi : How-to comment multiple lines.



Comment multiple lines using vi

That’s actually quite easy, follow the next 5 steps and you’re done !

  1. Enter “visual mode” (allow you to “visually” highlight / select text): [CTRL]+v
  2. Move your cursor up to the end of the desired selection
  3. Press [SHIFT]+i to enter edition mode
  4. Insert the desired character (e.g : #) just once
  5. Press [ESC] and wait a second to allow vi to process your request

Here we are !


More “vi” posts


Leave a Reply

Your email address will not be published. Required fields are marked *

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag and format it when submitted.