DEV Community

Discussion on: 3 Ways to Comment Out Blocks of Code in vi

Collapse
 
adriengiboire profile image
Adrien Giboire • Edited

Quick tips:

  • To go to the beginning/end of your function/block, you can use %
  • Instead of typing the line numbers in your s command, you can highlight the lines and type :. It will prompt :'<,'> and you can continue with your command, i.e. s/^/\/\//, then Enter.

Hope I was clear :)

Collapse
 
grepliz profile image
Liz Lam

Thanks for the tip!