Install a Git Plugin for VIM: git-vim

To install git-vim run:

cd ~/Downloads
git clone https://github.com/myw/git-vim.git
cd git-vim
# by default, the Makefile is set up for Mac OS. If you use a different OS change it using:
cat Makefile | sed "s|#INSTALL=install|INSTALL=install|g" | grep -v ginstall > Makefile
# then install the plugin:
make install

This will copy the following files to ~/.vim:

  • plugin/git.vim
  • syntax/:
    • git-diff.vim
    • git-log.vim
    • git-status.vim
  • doc/git-vim.txt

Usage:
When you open vim in a directory containing a git repository, you can use the commands like as defined in the README such as :GitStatus, :GitDiff and many more. If you want to use the shorter forms you should set the mapleader in your ~/.vimrc:

cat << EOF >> ~/.vimrc
let mapleader = ","
EOF

Afterwards you can do a git diff using ,gd and a git status using ,gs.

To uninstall run:

cd ~/Downloads/git-vim
make uninstall

resources

Comments