How do I comment a block of lines in YAML?
In Vim you can do one of the following:
:%s/^/#
:10,15s/^/#
:10,.s/^/#
:10,$s/^/#
or using visual block:
For Visual Studio Code (VSCode) users, the shortcut to comment out multiple lines is to highlight the lines you want to comment and then press:
ctrl + /
Pressing ctrl + / again can also be used to toggle comments off for one or more selected lines.
In Azure Devops browser(pipeline yaml editor),
Ctrl + K + C Comment Block
Ctrl + K + U Uncomment Block
There also a 'Toggle Block Comment' option but this did not work for me.
There are other 'wierd' ways too: right click to see 'Command Palette' or F1
Then choose a cursor option.
Now it is just a matter of #
or even smarter [Ctrl + k] + [Ctrl + c]
The spec only describes one way of marking comments:
An explicit comment is marked by a “#” indicator.
That's all. There are no block comments.
If you are using Eclipse with the yedit plugin (an editor for .yaml files), you can comment-out multiple lines by:
And to un-comment, follow the same steps.