On Wed, Aug 22, 2012 at 06:49:06PM -0500, Tim Chase wrote:
> [snip]
> which modified file do you want.  I'll often instruct Vim to ignore
> the file on disk, yank the entire contents (":%y") and paste them in
> a new buffer (":vnew", "PGdd"), go back to the original file and
> force a reload of it (":e!") to get the other modified version, then
> use Vim's diffing abilities to compare the two (":diffthis" in each
> window).  That allows me to have both versions and make sure I
> eventually save what I really want.

You might be interested in the :DiffOrig command from
vimrc_example.vim which automates this task, here's a slightly
improved version which keeps the filetype:

    command DiffOrig
        \ let s:diff_orig_filetype = &filetype
        \ | vertical new
        \ | let &filetype = s:diff_orig_filetype
        \ | unlet s:diff_orig_filetype
        \ | set buftype=nofile
        \ | read ++edit #
        \ | 0d_
        \ | diffthis
        \ | wincmd p
        \ | diffthis

Regards,
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

Attachment: pgpS5ewpDusfj.pgp
Description: PGP signature

Reply via email to