Inline git blame plugin for Vim. Shows git blame information for the current line using text properties.
- Inline git blame display using Vim's text properties
- CoC/LSP compatible - does not override inline diagnostics
- Caching for performance
- Relative time display (e.g., "2 hours ago")
- Customizable format and highlight
- Toggle on/off with commands
- Vim 8.2 or higher (for text properties support)
- Git installed and available in PATH
- File must be in a git repository
Add to your .vimrc:
Plug 'fmflurry/vim-git-blame'Add to your .vimrc:
Plugin 'fmflurry/vim-git-blame'Copy the plugin files to your ~/.vim directory:
cp -r vim-git-blame/plugin ~/.vim/
cp -r vim-git-blame/autoload ~/.vim/Once installed, the plugin automatically displays git blame information for the current line.
:GitBlameToggle- Toggle git blame on/off:GitBlameEnable- Enable git blame:GitBlameDisable- Disable git blame
Add to your .vimrc to customize:
" Enable/disable (default: 1)
let g:git_blame_enabled = 1
" Highlight group (default: 'GitBlame')
let g:git_blame_highlight_group = 'GitBlame'
" Format string (default: '%an · %ar · %s')
" Available placeholders:
" %an - author name
" %ae - author email
" %ar - author date (relative)
" %s - commit summary
" %h - abbreviated commit hash
let g:git_blame_format = '%an · %ar · %s'To customize the highlight color, add to your .vimrc:
" Using specific colors
hi GitBlame guifg=#6a737d guibg=NONE ctermfg=243 ctermbg=NONE
" Or link to an existing highlight group
hi link GitBlame Comment
hi link GitBlame LineNrThe plugin uses Vim's text properties feature (available in Vim 8.2+) to display inline text without modifying the actual buffer content.
This plugin is designed to work alongside CoC and other LSP plugins:
- Different property type: Uses
GitBlameproperty type, distinct from CoC's virtual text - Lower priority: Set to priority 10, while LSP diagnostics typically use higher priorities
- End-of-line placement: Blame info appears after line content, avoiding conflicts with inline diagnostics
The blame information appears as:
your code here John Doe · 2 hours ago · Fix the bug
- Blame information is cached per file and line
- Debounced cursor movement (100ms) to prevent excessive updates
- Cache is automatically invalidated when buffer is saved
- Check if file is in a git repository
- Ensure you're using Vim 8.2+:
:versionshould show 8.2 or higher - Check if text properties are available:
:echo exists('*prop_add')should return1 - Verify git blame works:
:!git blame -p -L 5,5 %in Vim
If you see conflicts, adjust the priority in plugin/git-blame.vim:
" Lower priority (shown before diagnostics)
call prop_type_add('GitBlame', #{priority: 10})
" Higher priority (shown after diagnostics)
call prop_type_add('GitBlame', #{priority: 1000})MIT
Contributions are welcome! Please feel free to submit issues or pull requests.