all as described in How do I use vim as 'git log' editor? doesn\'t work for git show . I use often
git show HEAD
ctrl+z
ps
PID TTY TIME CM
Here is a Twitter post to solve that problem.
https://twitter.com/oliviergay/status/179692941063888896
Using
git show
withvim
and syntax highlighting:vimgitshow() { git show "$1" | vim - "+set filetype=${1##*.}"; }
can simply use git show bf9f84042 | vim -
in edit mod, or git show bf9f84042 | vim -R -
in read only mod, without changing gitconfig
or
git config --global diff.tool vimdiff
using vimdiff as diff.tool, and then git difftool bf9f042 232wf2f
to diff
You can use the following command:
PAGER='vim -' git -c color.ui=false show
You might also want to use a better diff than just patch syntax highlighting. It allows you to use git show
and see the diff for each file in vimdiff
. See this answer.
This worked for me:
git config --global pager.show "vim -c '%sm/\\e.\\{-}m//g' -c 'set ft=diff' +1 -"
Crazy vim args found here: https://stackoverflow.com/a/17015531/610634