Skip to content

Instantly share code, notes, and snippets.

@wayou
Last active January 25, 2019 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wayou/fc76f68ff607739d77d42ceff9283caa to your computer and use it in GitHub Desktop.
Save wayou/fc76f68ff607739d77d42ceff9283caa to your computer and use it in GitHub Desktop.
comment/uncomment batch lines of code in vim

comment

  • go to the first line you want to comment
  • control + c enter visual mode
  • navigate to the last line you want to comment
  • shift + i enter edit mode
  • type the comment symbol #,// or whatever
  • press ESC twice to exit

uncomment

  • go to the first line you want to uncomment
  • control + c enter visual mode
  • navigate to the last line of the comment block
  • select characters if the comment symbol is more than one character like //
  • press x to delete
  • press ESC twice to exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment