How do you do block comments in YAML?

前端 未结 11 1609
误落风尘
误落风尘 2020-12-04 04:26

How do I comment a block of lines in YAML?

11条回答
  •  猫巷女王i
    2020-12-04 05:14

    In Vim you can do one of the following:

    • Comment all lines: :%s/^/#
    • Comment lines 10 - 15: :10,15s/^/#
    • Comment line 10 to current line: :10,.s/^/#
    • Comment line 10 to end: :10,$s/^/#

    or using visual block:

    1. Select a multiple-line column after entering visual block via Ctrl+v.
    2. Press r followed by # to comment out the multiple-line block replacing the selection, or Shift+i#Esc to insert comment characters before the selection.

提交回复
热议问题