Ⅰ. 插件描述
A minimalistic addon to lightline to show a concise summary of changes since the last commit using git diff.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'macthecadillac/lightline-gitdiff'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'macthecadillac/lightline-gitdiff'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'macthecadillac/lightline-gitdiff'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/macthecadillac/lightline-gitdiff
Ⅳ. 文档说明
# Lightline-gitdiff
A minimalistic addon to the great lightline plugin to show a concise summary of
changes since the last commit.
TODO
- [ ] Make compatible with vim8 async features
Requirements
Git
Lightline-gitdiff is known to work with git 2.11 or above. This plugin was
tested on Debian 9 and testing. Older versions of git should work but that is
not guaranteed.
This plugin uses Neovim's job-control API if neovim is detected. Calls to git
are otherwise synchronous. Note that the plugin might lag on write/load if your
shell is set to fish and that has('nvim') is 0. Work with vim8's async
features is planned.
Lightline
Installation
Add the following line to your init.vim/.vimrc
Plug 'macthecadillac/lightline-gitdiff'Configuration
Available configuration options
let g:lightline_gitdiff#indicator_added = '+'
let g:lightline_gitdiff#indicator_deleted = '-'
let g:lightline_gitdiff#indicator_modified = '!'
let g:lightline_gitdiff#min_winwidth = '70'These defaults could be overridden in your configurations.
To integrate with lightline, use lightline_gitdiff#get_status() as the hook.
Example configuration
let g:lightline = {
\ 'active': {
\ 'left': [['mode', 'paste'],
\ ['gitbranch', 'gitstatus', 'filename']],
\ },
\ 'component': {
\ 'gitstatus': '%<%{lightline_gitdiff#get_status()}',
\ },
\ 'component_visible_condition': {
\ 'gitstatus': 'lightline_gitdiff#get_status() !=# ""',
\ },
\ }
License
MIT