Monday, May 28, 2018

Re: vimdiff exit when files are identical?

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.

-tim




--
--
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