Seems vim still lack of these two features. Thanks everybody Eddy
2006/8/11, Bob Hiestand <[EMAIL PROTECTED]>:
On 8/10/06, Marc Weber <[EMAIL PROTECTED]> wrote: > On Thu, Aug 10, 2006 at 11:02:50PM +0800, Eddy Zhao 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. > > I would have proposed using the diff commands, too.. > (See DiffWithFileOnDisk in my privious post.....) > Perhaps it would be better to save to tempname() because those files > will be deleted automatically.. I think Tim's method is better in that it doesn't require a file at all. Depending on personal preference, it might be better to explicitly make the diff buffer a scratch buffer, in something like the following: command! -nargs=0 ShowDifferences \ let ShowDifferencesOriginalBuffer=bufnr('%') \|execute 'bufdo diffoff' \|execute 'buffer' ShowDifferencesOriginalBuffer \|diffthis \|unlet ShowDifferencesOriginalBuffer \|below vert new \|set buftype=nofile noswapfile bufhidden=wipe \|r # \|1d \|diffthis There's a little extra there to clear diff mode from other buffers to avoid including more than the two intended buffers in the diff mode.