* Running vimdiff in read-only mode with git-difftool?
@ 2009-05-18 5:01 Nick Welch
2009-05-18 5:42 ` David Aguilar
2009-05-18 5:51 ` David Aguilar
0 siblings, 2 replies; 4+ messages in thread
From: Nick Welch @ 2009-05-18 5:01 UTC (permalink / raw)
To: git
I'm running:
git difftool -y --tool=vimdiff -U99999 --patience
and I have the following in ~/.gitconfig:
[difftool "vimdiff"]
cmd = "vimdiff -R"
But vimdiff is still run in read/write mode. In the output of ps, I see:
vim -d -c wincmd l /tmp/.diff_bP2Tjf <original file>
There should be an -R in there, but there's not. And if I'm trying to
edit <original file> in another instance of vim, I get the annoying "a swap
file exists, what should I do?" message, which is my main motivation in
trying to use read-only mode.
According to the git-difftool manpage, what I'm trying to do should work:
Instead of running one of the known diff tools, git-difftool can be
customized to run an alternative program by specifying the command line to
invoke in a configuration variable difftool.<tool>.cmd.
I've also tried specifying the full path to vim diff, like this:
[difftool "vimdiff"]
cmd = "/usr/bin/vimdiff -R"
and it didn't work either.
Any ideas?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Running vimdiff in read-only mode with git-difftool?
2009-05-18 5:01 Running vimdiff in read-only mode with git-difftool? Nick Welch
@ 2009-05-18 5:42 ` David Aguilar
2009-05-18 5:51 ` David Aguilar
1 sibling, 0 replies; 4+ messages in thread
From: David Aguilar @ 2009-05-18 5:42 UTC (permalink / raw)
To: Nick Welch; +Cc: git
On Sun, May 17, 2009 at 10:01:02PM -0700, Nick Welch wrote:
>
> According to the git-difftool manpage, what I'm trying to do
> should work:
>
> Instead of running one of the known diff tools,
> git-difftool can be customized to run an alternative
> program by specifying the command line to invoke in a
> configuration variable difftool.<tool>.cmd.
Custom difftool.<tool>.cmd settings only work for custom
(i.e. alternative/non-built-in) tools.
If you rename that to something like "myvimdiff"
(or anything != "vimdiff") then it'll work as expected.
I wouldn't be opposed to a patch making
{diff,merge}tool.<tool>.cmd work for built-in tools as
well as long as it had a testcase and didn't end up
making the code unnecessarily complex.
--
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Running vimdiff in read-only mode with git-difftool?
2009-05-18 5:01 Running vimdiff in read-only mode with git-difftool? Nick Welch
2009-05-18 5:42 ` David Aguilar
@ 2009-05-18 5:51 ` David Aguilar
2009-05-18 6:06 ` Nick Welch
1 sibling, 1 reply; 4+ messages in thread
From: David Aguilar @ 2009-05-18 5:51 UTC (permalink / raw)
To: Nick Welch; +Cc: git
On Sun, May 17, 2009 at 10:01:02PM -0700, Nick Welch wrote:
> I'm running:
>
> git difftool -y --tool=vimdiff -U99999 --patience
>
> and I have the following in ~/.gitconfig:
>
> [difftool "vimdiff"]
> cmd = "vimdiff -R"
I forgot to mention a couple of things.
If you do change that to e.g. "myvimdiff" you'll need
the $LOCAL and $REMOTE params as well; probably something
like:
[difftool "myvimdiff"]
cmd = vim -R -d -c wincmd l \"$LOCAL\" \"$REMOTE\"
$ git difftool -y -t myvimdiff
Secondly, git-difftool receives both the pre and post-image
and doesn't actually receive the output of git-diff, so passing
--patience unfortunately won't do what you're expecting it to
do. Piping the output of git-diff to something like kompare(?)
is probably the only way to get the nice --patience result.
It'd be nice if all diff/merge tools supported the patience
diff algorithm but that's not the case right now.
--
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Running vimdiff in read-only mode with git-difftool?
2009-05-18 5:51 ` David Aguilar
@ 2009-05-18 6:06 ` Nick Welch
0 siblings, 0 replies; 4+ messages in thread
From: Nick Welch @ 2009-05-18 6:06 UTC (permalink / raw)
To: David Aguilar; +Cc: git
As soon as I got your first reply, I started digging and managed to
figure out the $LOCAL and $REMOTE part.
Another interesting issue is that vim doesn't syntax-highlight the temp
file, because the file extension hasn't been carried over to the temp
file's filename. I might see if I can figure out how to hack git to
do that.
Thanks for the help.
Nick
On Sun, May 17, 2009 at 10:51 PM, David Aguilar <davvid@gmail.com> wrote:
> On Sun, May 17, 2009 at 10:01:02PM -0700, Nick Welch wrote:
>> I'm running:
>>
>> git difftool -y --tool=vimdiff -U99999 --patience
>>
>> and I have the following in ~/.gitconfig:
>>
>> [difftool "vimdiff"]
>> cmd = "vimdiff -R"
>
> I forgot to mention a couple of things.
>
>
> If you do change that to e.g. "myvimdiff" you'll need
> the $LOCAL and $REMOTE params as well; probably something
> like:
>
> [difftool "myvimdiff"]
> cmd = vim -R -d -c wincmd l \"$LOCAL\" \"$REMOTE\"
>
>
> $ git difftool -y -t myvimdiff
>
>
> Secondly, git-difftool receives both the pre and post-image
> and doesn't actually receive the output of git-diff, so passing
> --patience unfortunately won't do what you're expecting it to
> do. Piping the output of git-diff to something like kompare(?)
> is probably the only way to get the nice --patience result.
>
> It'd be nice if all diff/merge tools supported the patience
> diff algorithm but that's not the case right now.
>
> --
>
> David
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-18 6:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18 5:01 Running vimdiff in read-only mode with git-difftool? Nick Welch
2009-05-18 5:42 ` David Aguilar
2009-05-18 5:51 ` David Aguilar
2009-05-18 6:06 ` Nick Welch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).