How do I use vim as 'git log' editor?

Shengjie picture Shengjie · May 21, 2013 · Viewed 9.6k times · Source

When I run git log, what exactly is the editor git log is using?

Also:

  1. Is there anyway I can use vim as my default editor for git log?
  2. If I want to search against the git log, what's the best way? Now I'm doing something like: git log | grep bla.

Answer

user1019830 picture user1019830 · May 21, 2013

The git log command pipes it's output by default into a pager, not an editor. This pager is usually less or more on most systems. You can change the default pager to vim with the command:

git config --global core.pager 'vim -'

Now you can search using vim functionality with / as usual.