Ⅰ. 插件描述
Populate the QuickFix list with the output of git-diff commandⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'oguzbilgic/vim-gdiff'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'oguzbilgic/vim-gdiff'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'oguzbilgic/vim-gdiff'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/oguzbilgic/vim-gdiff
Ⅳ. 文档说明
# Gdiff
The missing :Gdiff command for Vim. Populates the QuickFix list with the output
of git-diff command
Credit: Originally written by @eloytoro
https://github.com/tpope/vim-fugitive/issues/132#issuecomment-290644034
Install
Using vim-plug add the following line to your vimrc.
Plug 'oguzbilgic/vim-gdiffRun the command bellow to install the plugin:
:PlugInstallUsage
:Gdiff {revision}Example
If you are on a feature branch, the following command will populate the quick
fix list with all the files changed only on that branch, useful for code
reviews.
:Gdiff master... Extra
Once you populate the quick fix list you can easily cycle through the using
following mappings. You can add these to your .vimrc
" Quickfix motions
nnoremap [q :cprevious<cr>
nnoremap ]q :cnext<cr>
nnoremap [Q :cfirst<cr>
nnoremap ]Q :clast<cr>Additionally, you can cycle the list using fugitive :Gdiffsplit command.
nnoremap ]r :%bd<CR>:cnext<CR>:Gdiffsplit master<CR>
nnoremap [r :%bd<CR>:cprevious<CR>:Gdiffsplit master<CR>
nnoremap ]R :%bd<CR>:clast<CR>:Gdiffsplit master<CR>
nnoremap [R :%bd<CR>:cfirst<CR>:Gdiffsplit master<CR>]r will open the next file with a diff view.