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 CMD
7083 pts/8 00:00:06 bash
31758 pts/8 00:00:00 git
31759 pts/8 00:00:00 less
31762 pts/8 00:00:00 ps
Update I found the solution :
git config --global pager.color false
git config --global pager.show 'vim -R -'
Even better (2021-02-05)
git config --global core.pager 'vim -R -'
https://stackoverflow.com/a/16666055/778517
Git command works in the command line interface. The vim plugin named fugitive plugin is developed by Tim pope which is used to work with the git tool without terminating the editor. So, vim and git can work together by using the fugitive plugin.
On Windows, if you use Git Bash the default editor will be Vim. Vim is another text editor, like nano or notepad.
What is Vim? Vim is a text editor for Unix that comes with Linux, BSD, and macOS. It is known to be fast and powerful, partly because it is a small program that can run in a terminal (although it has a graphical interface). It is mainly because it can be managed entirely without menus or a mouse with a keyboard.
You can use the following command:
PAGER='vim -' git -c color.ui=false show
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##*.}"; }
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With