Tuesday, May 29, 2018

Re: vimdiff exit when files are identical?

Tim Chase wrote:

> On 2018-05-28 18:11, M Kelly wrote:
> > Is there a variable for how many diffs are present after starting
> > vimdiff ? I'd like to exit immediately with status of 0 if there
> > are no differences between the files I pass into vimdiff.
>
> Not that I know of off the top of my head (though if there is, I'd be
> glad to stash that new knowledge away), but you can do a quick check
> before invocation:
>
> diff -q file1 file2 >/dev/null && echo same || vimdiff file1 file2
>
> which could be wrapped in an alias/function to simplify the
> invocation.

Another way would be to check the fold regions.

--
The process for understanding customers primarily involves sitting around with
other marketing people and talking about what you would to if you were dumb
enough to be a customer.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment