Reputation: 12796
When I run git log
, what exactly is the editor git log
is using?
Also:
vim
as my default editor for git log
?git log | grep bla
.Upvotes: 12
Views: 14795
Reputation: 2863
I had write a bash script to switch from using vim as editor to diff-so-fancy.
VT() {
gitlogflag=true
if [ -e "$HOME/.myscriptvar" ] ; then
gitlogflag=$(cat "$HOME/.myscriptvar")
fi
if [ "$gitlogflag" = true ]; then
git config --global pager.show "vim -c '%sm/\\e.\\{-}m//g' -c 'setlocal buftype=nofile' -c 'set ft=diff' +3 -";
gitlogflag=false
else
git config --global pager.show "diff-so-fancy | less --tabs=1,5 -RFX";
gitlogflag=true
fi
echo "$gitlogflag" > $HOME/.myscriptvar
}
I recommend you to use diff-so-fancy.
If you just want to use vim as your git log editor git config --global pager.show "vim -c '%sm/\\e.\\{-}m//g' -c
will satisfy you.
Upvotes: 0
Reputation: 18241
You may want to look at viewlog.
It gives you a terminal gui interface to all commits. It will also open the file in the editor of your choice. You can search for relevant commits using the --grep flag.
Upvotes: 1
Reputation:
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.
Upvotes: 31