Occasionally I want to move all lines in a file to the top of that file.
:g/PATTERN/m0 almost does what I want, but because
:g operates one line at a time in order, it will also reverse the affected lines.
Consider this file. Say I want to separate lines containing a number and move them to the top of the file.
:g/\d/m0 does almost what I want (fr4nk, car0l and b0b are moved to the top) -- but it reverses the order of the matched lines.
alice b0b car0l dan eve fr4nk
fr4nk car0l b0b alice dan eve
b0b car0l fr4nk alice dan eve
One way of doing what I want is to use
:g/PATTERN/m$ (which won't reverse lines) and then move the lines from the bottom of the file to the top. Is there anything simpler?