Is there a NERDTree or other project plugin for vim that integrates with git to show the status of files?
Asked Answered
H

4

15

I played with Aptana Studio for a while before moving over to VIM, and the only thing I really miss about Aptana Studio is the way that in their project view window your file names showed up a different color depending on their status in git (unchanged, changed but not staged, staged, untracked). I know I can just go to terminal and find out, but having it right there in my editor without having to type any commands is really helpful.

Does anyone know if a plugin with this functionality exists for vim? Whether it is a plugin for NERDTree, a replacement, or something else?

Herb answered 23/6, 2011 at 13:54 Comment(0)
O
11

For future reference, I created a fork of NERDTree that does exactly that, it can be found at https://github.com/SeySayux/NerdTreeGit .

Please note it's still in development, so it may break. It also contains a few oddities for which there aren't configurable options yet.

UPDATE: The project linked above is discontinued. For a (much better) alternative, try this: https://github.com/Xuyuanp/nerdtree-git-plugin

Owsley answered 29/10, 2012 at 11:49 Comment(4)
Perfect in terms of feature/UI. But display is buggy when navigating as some redraws do not happen. Keep on the good job!Maurist
Is this gone for ever? Link is brokenManda
@Hubro: Yes, I'm no longer maintaining that project. Updated the post with a better alternative.Owsley
The alternative is archived, without any news.Odeliaodelinda
B
9

Have you looked at fugitive.vim? It doesn't do exactly what you're looking for in terms of color-coding NERDTree based on git status -- I'm not aware of any Vim plugin that does, though it would be awesome. It does function as a pretty great little Git wrapper, and allows you to quickly view your project's status in a split window with :Gstatus. No need to go to the terminal. You can even add a branch indicator for the current file to Vim's status line.

You can watch the first in a five-part screencast on fugitive.vim here.

Babur answered 23/6, 2011 at 18:20 Comment(1)
+1 for the comment about adding the branch indicator, wasn't aware of this feature when using fugitive :)Flageolet
N
4

I use the git.vim plugin that provides several git functionalities like add/commit/diff/log, etc. So from within vim, I've mapped <Leader>gs to GitStatus, which opens a new viewport and displays the status neatly:

enter image description here

But my favorite feature of this plugin is the GitBranch() function with which you can add the current branch to your status line, as I have outlined in a previous answer of mine.

Along the same lines, it should be possible to write a function that calls GitStatus and greps the output and reports whether there are staged changes or unstaged changes present in the repo, which can then be conveniently added to the statusline.

Negligible answered 23/6, 2011 at 18:38 Comment(0)
S
2

I guess you would like this https://github.com/Xuyuanp/git-nerdtree

It's my forked NERDTree.

Add git status support for NERDTree.You can indicate a file's git status, quickly see which files you have staged, unstaged and modified, or deleted in your project without any extra work.

Indicator

  • ✭ : Untracked
  • ✹ : Modified in the working tree
  • ✚ : Staged in the index (Exclude Renamed status)
  • ➜ : Renamed
  • ═ : Unmerged
  • ✖ : Deleted (This indicator can't be shown, as NERDTree doesn't display deleted files. I have no prefect idea to solve this problem currently.)
  • ✗ : Dirty (Only for directory)
  • ✔︎ : Clean (Only for directory)

Key mapping

As the same as GitGutter plugin default.

  • ]c : Jump to next indicator
  • [c : Jump to prev indicator
Stammel answered 9/4, 2014 at 6:28 Comment(1)
Be carefull. It's still under development.Stammel

© 2022 - 2024 — McMap. All rights reserved.