I don't know the specific commands necessary to invoke vimdiff so that the uncommitted file is opened in write mode, but in general, git does in fact have configuration settings that you can use to set up how your difftool if invoked when you use git difftool
. See the difftool.<tool>.cmd
setting in the git difftool doc and the git config doc:
difftool.<tool>.cmd
Specify the command to invoke the specified diff tool. The specified command is evaluated in shell with the following variables available:
$LOCAL
is set to the name of the temporary file containing the contents of the diff pre-image and$REMOTE
is set to the name of the temporary file containing the contents of the diff post-image.
So you could do something like this to configure your difftool:
$ git config --global difftool.myDifftool.cmd \
"myDifftool --read-only-flag $LOCAL --editable-flag $REMOTE"
Based on the link to Vimdiff multiple windows different read/write permission that mah posted, I guess you could configure difftool
for vimdiff this way, but I'm not sure if the vimdiff options are actually correct:
$ git config --global difftool.vimdiff.cmd \
"vimdiff -R $LOCAL -c ':se noreadonly' $REMOTE"