Search code examples
gitvimpagergit-log

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


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.

Solution

  • 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.