On 8/10/06, Eddy Zhao <[EMAIL PROTECTED]> wrote:
Hi,

  Very often, I open a lot of files to edit. When I exiting vim, vim
prompt me to save every file which contain changes not saved yet. So,

  - Is there plugin that could highlight the
changed-yet-not-saved-lines (possibly with yellow background), so that
I could easily locate and check those changes and decide whether to
save it or not.

  - Furthermore, is there plugin that could highlight the
changed-and-saved-lines in a vim session in the file (possibly with
green background), so that I could easily audit all changes of a file
in a vim edit session.

   BTW, this feature is borrowed from a commercial editor I tried
sometime ago, and find very useful when editing a lot of source code
files.


You can invoke vimdff to see differences. That requires temp copying:
1. :!cp % %.orig
   :diffsplit %.orig
or
   :vert diffsplit %.orig
It would be more convenient if :vimslpit allowed diff of the current buffer
with original file on disk directly, but as far as I can see it
doesn't allow it,
you need to copy the file. It's not that bad, can be assigned to a macro:
   :nmap <F5> :!cp % %.orig<cr>:vert diffsplit %.orig<cr>

2. :w! %.tmp
   and invoke 'vimdiff file file.tmp' in the other window

3. Less sophisticated method of revewing the changes:
        :w !diff -u - %
(NB you must have space between 'w' and '!'). It does not highlight any
lines but it's simple an it let you review your changes.

Yakov

Reply via email to