Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Vim to quickly see Mercurial or Git changes

Tags:

git

vim

mercurial

As I'm editing a file in Vim, I would like to quickly highlight any changes I have made since my last commit, while still being able to edit the file. Is there anything that comes close to doing this?

like image 309
Kyle Heironimus Avatar asked Dec 10 '10 18:12

Kyle Heironimus


People also ask

What is git vim?

Git is a distributed version control system, which you can use directly from Vim with some help from plugins: vim-fugitive (status unknown). Help text is provided. git-vim (included with Vim 7.1 and later). Provides ftplugin and syntax files for editing various git files (e.g. commit messages).

Can I use vim with git?

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.


2 Answers

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.

like image 22
Abizern Avatar answered Sep 22 '22 04:09

Abizern


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:

enter image description here

like image 50
Anthony Panozzo Avatar answered Sep 24 '22 04:09

Anthony Panozzo