git-blame.vim


Ⅰ. 插件描述

git blame

Ⅱ. 基本信息

创建日期:  2018-01-12
使用用户:  1
Github星:  1
插件作者:  年糕小豆汤

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'iamcco/git-blame-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'iamcco/git-blame-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'iamcco/git-blame-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/iamcco/git-blame.vim

Ⅳ. 文档说明

#### Usage

get blame info of the current buffer

function: git_blame#get_lines_blame

" get blame of current line
echo git_blame#get_lines_blame()
" output
['00000000 (Not Committed Yet 2018-01-12 17:17:36 +0800 20)']

" get blame by line number
echo git_blame#get_lines_blame(line_number)
" output
['00000000 (Not Committed Yet 2018-01-12 17:17:36 +0800 20)']

" get blame by range
echo git_blame#get_lines_blame(start_line, end_line)
['^bbae2c1 (guangzhou.chen    2018-01-12 16:02:46 +0800 1) ### git-blame.vim', '00000000 (Not Committed Yet 2018-01-12 17:19:11 +0800 2)']

function: git_blame#get_lines_blame_parse

same with git_blame#get_lines_blame but with different result

" get blame of current line
echo git_blame#get_lines_blame()
" output
{'status': v:true, 'date': '2018-01-12', 'user': 'Not Committed Yet', 'time': '17:29:15', 'input': '00000000 (Not Committed Yet 2018-01-12 17:29:15 +0800 35) {''status'': v:false, ''input'': ''fatal: file README.md has only 23 lines''}', 'commit': '00000000 '}

get blame of file

echo git_blame#get_blame(start_line, end_line, file_path)

parse blame info

echo git_blame#parse_blame('00000000 (Not Committed Yet 2018-01-12 17:17:36 +0800 20)')
" output
{'status': v:true, 'date': '2018-01-12', 'user': 'Not Committed Yet', 'time': '17:30:52', 'input': '00000000 (Not Committed Yet 2018-01-12 17:30:52 +0800 20) [''00000000 (Not Committed Yet 2018-01-12 17:17:36 +0800 20)'']', 'commit': '00000000 '}

添加新评论