Skip to content

Instantly share code, notes, and snippets.

@ezarko
Last active March 14, 2022 16:24
Show Gist options
  • Save ezarko/d660d9653fae7a746094 to your computer and use it in GitHub Desktop.
Save ezarko/d660d9653fae7a746094 to your computer and use it in GitHub Desktop.
Use vimdiff for git diff
# vim
echo "au! BufRead,BufNewFile /tmp/* setlocal buftype=nofile" >> ~/.vimrc
echo "au! BufRead,BufNewFile /proc/* setlocal buftype=nofile" >> ~/.vimrc
echo "syntax on" >> ~/.vimrc
echo "set laststatus=2" >> ~/.vimrc
echo "set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)" >> ~/.vimrc
# git
git config --global pager.diff ""
git config --global diff.external "/bin/bash -c 'vimdiff -o \"\$1\" \"\$4\"'"
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global core.excludesfile "$HOME/.gitignore"
touch ~/.gitignore
# subversion
mkdir -p ~/bin
cat <'EOF' > ~/bin/svn_diff_wrapper
#!/bin/sh
vimdiff -o "$6" "$7"
EOF
sed -i -e 's|^\s*#?\s*diff-cmd\s*=.*$|diff-cmd = $HOME/bin/svn_diff_wrapper|' ~/.subversion/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment