git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Running vimdiff in read-only mode with git-difftool?

From
NWNick Welch <nick@incise.org>
Date
May 18, 2009, 05:01 UTC
Message-ID
<9e00fd550905172201n6c95dc1bia48c9ac25d8ec98f@mail.gmail.com>
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?
Next: David Aguilar
Message 1 of 4 in “Running vimdiff in read-only mode with git-difftool?”
  1. Nick WelchMay 18, 2009
  2. David AguilarMay 18, 2009
  3. David AguilarMay 18, 2009
  4. Nick WelchMay 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.