Configure Git To Use Vimdiff
Run the following commands if you wish to set vimdiff as your diff tool:
git config --global diff.tool vimdiff
git config --global merge.tool vimdiff
Alternatively, add the following to your $HOME/.gitconfig
[diff]
tool = vimdiff
[merge]
tool = vimdiff
Now you can show differences by running:
git difftool
Allow Editing
By default, vimdiff will open the files in readonly mode so that you can't make any changes. You can enable editing inside the editor by running the following:
:set noro
To make this the default, edit your $HOME/.vimrc
config, add this (you may need to create it):
" Default to not read-only in vimdiff
set noro
Referemces
- Stack Overflow - Configuring diff tool with .gitconfig
- Stack Overflow - How to prevent git vimdiff from opening files as read-only?
Last updated: 9th May 2020
First published: 7th April 2020
First published: 7th April 2020