DEV Community


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

adriengiboire profile image
Adrien Giboire

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 :)

grepliz profile image
Liz Lam Author

Thanks for the tip!