Wednesday, July 13, 2011

How to compare with a remote file using Vim?

Two methods...

1) using vimdiff command from the terminal

$ vimdiff scp://username@remote_address//absolute/path/to/remote-file local-file

2) using diffsplit command within Vim.

:vert diffsplit scp://username@remote_address//absolute/path/to/remote-file

'vert' displays the two files side by side vertically, similar to the output of 'vimdiff' command. If it is omitted, files will be displayed horizontally.