How do I reverse the order of lines in a file or selection?
:%!tac
Vim doesn't have a built-in reverse command, but you can pipe the buffer through tac (reverse of cat) to flip line order.
:%!tac
Vim doesn't have a built-in reverse command, but you can pipe the buffer through tac (reverse of cat) to flip line order.
qa$bywdw0Pa <Esc>q
Record a macro that yanks the last word, deletes it, pastes it at the beginning of the line.