Programster's Blog

Tutorials focusing on Linux, programming, and open-source

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

    tool = vimdiff
    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


Last updated: 9th May 2020
First published: 7th April 2020