Ⅰ. 插件描述
A plugin of NERDTree showing git statusⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tsony-tsonev/nerdtree-git-plugin-or-are-not'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tsony-tsonev/nerdtree-git-plugin-or-are-not'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tsony-tsonev/nerdtree-git-plugin-or-are-not'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tsony-tsonev/nerdtree-git-plugin
Ⅳ. 文档说明
nerdtree-git-plugin
A plugin of NERDTree showing git status flags and/or highlights the file names according to the git status. Works with the LATEST version of NERDTree.
The original project git-nerdtree will not be maintained any longer.
Also credits to: @robinfehr

Dependencies
vim-devicons and vim-nerdtree-syntax-highlight
Installation
For Pathogen
git clone https://github.com/tsony-tsonev/nerdtree-git-plugin.git ~/.vim/bundle/nerdtree-git-plugin
Now reload the vim
For Vundle
Plugin 'scrooloose/nerdtree'
Plugin 'tsony-tsonev/nerdtree-git-plugin'
For NeoBundle
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'tsony-tsonev/nerdtree-git-plugin'
For Plug
Plug 'scrooloose/nerdtree'
Plug 'tsony-tsonev/nerdtree-git-plugin'
FAQ
Got error message like `Error detected while processing function
177[2]..178[22]..181[7]..144[9]..142[36]..238[4]..NERDTreeGitStatusRefreshListener[2]..NERDTreeGitStatusRefresh:
line 6:
E484: Can't open file /tmp/vZEZ6gM/1` while nerdtree opening in fish, how to resolve this problem?
This was because that vim couldn't execute system function in fish. Add set shell=sh in your vimrc.
This issue has been fixed.
How to config custom symbols?
Use this variable to change symbols.
let g:NERDTreeGitStatusWithFlags = 1
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }How to enable and customize file colors?
Use this variable to change colors. (It will use the colors for guifg)
Note: git ignored status is disabled by default, see below how to enable.
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:NERDTreeGitStatusNodeColorization = 1
let g:NERDTreeColorMapCustom = {
\ "Modified" : "#528AB3",
\ "Staged" : "#538B54",
\ "Untracked" : "#BE5849",
\ "Dirty" : "#299999",
\ "Clean" : "#87939A",
\ "Ignored" : "#808080"
\ } If you need more complex color solution the following custom mapping could be used
let g:NERDTreeColorMapCustom = {
\ "Modified" : ["#528AB3", "NONE", "NONE", "NONE"],
\ "Staged" : ["#538B54", "NONE", "NONE", "NONE"],
\ "Untracked" : ["#BE5849", "NONE", "NONE", "NONE"],
\ "Dirty" : ["#299999", "NONE", "NONE", "NONE"],
\ "Clean" : ["#87939A", "NONE", "NONE", "NONE"]
\ "Ignored" : ["#808080", "NONE", "NONE", "NONE"]
\ }The mapping array is the following [guifg, ctermfg, guibg, ctermbg]
Note: I you want to omit some value you must provide "NONE" as value
Want to disable the flags or the colors? Just set:
let g:NERDTreeGitStatusNodeColorization = 0
ORlet g:NERDTreeGitStatusWithFlags = 1
How to show
ignoredstatus?
let g:NERDTreeShowIgnoredStatus = 1 (a heavy feature may cost much more time)
Credits
- scrooloose: Open API for me.
- git_nerd: Where my idea comes from.
- PickRelated: Add custom indicators & Review code.
- @robinfehr: Where the idea for the colors came from.