How to use Vim to quickly see Mercurial or Git changes
one method is to do the following:
:!git diff
This will show the changes (to all files) in comparison to HEAD
to do a single file
:!git diff path/to/file
this is a quick way of doing it without switching different apps nor installing any plugins (which isn't always easy to do on some systems that you don't have control over).
it wont give you 'inline' highlighting but should work ok.
another way to do it quickly is to do a :r !git diff
take a look at the changes then type u
to undo the addition. This works nicely too, esp if you want to yank some text from HEAD
Edit 2020-01-23: Searched quickly and FYI saw that there's another plugin that seems more VCS agnostic: https://github.com/mhinz/vim-signify
There's a new plugin that does this: vim-gitgutter. It puts the changes in the Vim gutter whenever you save the file. Here's what it looks like in action:
Have a look at Tim Pope's fugitive.vim plugin.
I'm a git purist and usually drop into the command line for git, but when I'm in vim I find that this does most of what I need to do and yet I can still call git commands directly.
Try vcscommand plugin, use :VCSVimDiff
to view differencies with current revision (supports both hg and git, probably some other SCM systems as well) and internal :bdelete
(:bd
) (on opened buffer of course, not on already existing) to stop diffing. If you are using gentoo, it is available in the repository: app-vim/vcscommand
.