Sorting and comparing in vi / vim / vimdiff

I regularly use vimdiff to compare files on a local server with a remote server via SFTP. I keep forgetting how to get VI to refesh the view when one of the files has changed on the filesysem. It’s simply done with
:diffupdate
When comparing, if the order of lines in the file doesn’t matter and you think that they are similar except for the order, you can also use the built-in command:
:sort
to sort the lines. Mark the lines you want to sort first with visual marking mode (V) and then apply the sort.

Leave a Reply

Your email address will not be published. Required fields are marked *