How do I sort this file so that - removes the lines starting with ###
:g/^###/d
- removes the lines starting with ---
:g/^---/d
- removes the lines starting with spaces
:g/^\s\+/d
- all line 18 , i.e., comes under each other? And line 19 , and so on.
:%!sort(or, newer versions of vim may have a built-in sort-function, which can be used like
:%sort Those first three commands can be combined, if desired: :g/^\(###\|---\|\s\+\)/d HTH, -tim