What's the most elegant way of commenting / uncommenting blocks of ruby code in Vim?

前端 未结 10 683
悲哀的现实
悲哀的现实 2021-01-30 13:23

In VIM, at the moment when I need to comment out a section of Ruby code:

  • I navigate to the first column in the row I want to comment out
  • I press CTRL-v t
10条回答
  •  醉话见心
    2021-01-30 13:57

    You can also do this:

    • Move to the first line to comment out
    • press 'ESC' then
    • Hit Ctrl + q to enter Visual Block mode
    • Move done to the last line to comment out
    • Hit I, comment out by pressing #
    • Hit ESC

    And to uncomment:

    • Move to the first # of comment
    • Hit Ctrl + q to enter Visual Block mode
    • Move done to the last line to comment out
    • Hit d to remove the comment characters

提交回复
热议问题