neovim version: >= 0.5.0-dev ( or nightly version )
the git
cli must exists in your system and in PATH
env
- configuable message format
- delay auto hide feature
- dynamic toggle
just install the plugin and it should works automatically.
for example, use vim-plug
Plug 'ttys3/nvim-blamer.lua'
""" must after plugin loaded, for example,
""" if you are using vim-plug, this should put after `call plug#end()`
""" enable auto show blame info when cursor move
call nvimblamer#auto()
""" config the plugin
lua <<EOF
require'nvim-blamer'.setup({
enable = true,
format = '%committer │ %committer-time-human │ %summary',
})
EOF
{
enable = false, -- you must set this to true in order to show the blame info
prefix = ' ', -- you can cusomize it to any thing, unicode emoji, even disable it, just set to empty lua string
format = '%committer │ %committer-time %committer-tz │ %summary',
auto_hide = false, -- set this to true will enable delay hide even you do not have the cursor moved
hide_delay = 3000, -- this is the delay time in milliseconds for delay auto hide
show_error = false, -- set to true to show any possible error (just for debug problems)
}
you may need install some patched font to use unicode emoji, like NerdFont https://github.com/ryanoasis/nerd-fonts
you can find your favorite emoji using https://www.nerdfonts.com/cheat-sheet
here are some emoji candicates:
\uE702
\uF1D2
\uF1D3
\uE80D
\uF417
you can use filename
, hash
, summary
, committer
, committer-mail
, committer-tz
, committer-time
and committer-time-human
{
"filename": "lua/blamer.lua",
"hash": "db43ae622dbec1ba3fd8172c2d4fed1b2980c39c",
"hash-short": "db43ae6",
"summary": "fix: bypass ft list: rename LuaTree to NvimTree. do not show Not Committed Yet msg",
"committer": "荒野無燈",
"committer-mail": "<a@example.com>",
"committer-tz": "+0800",
"committer-time": "1610563580",
"author": "荒野無燈",
"author-mail": "<a@example.com>",
"author-time": "1610563580",
"author-tz": "+0800",
}
""" auto show blame info when cursor move
:NvimBlamerAuto
""" toggle blame info display
:NvimBlamerToggle
thanks for the unicode emoji from https://github.com/romkatv/powerlevel10k/blob/3920940ea84f6fba767cbed3fe6ba0653411c706/internal/icons.zsh#L226
the idea and the init code come from https://www.reddit.com/r/neovim/comments/f1vxhl/replicate_the_basic_functionality_vscodes_gitlens/ https://teukka.tech/vimtip-gitlens.html
https://github.com/APZelos/blamer.nvim
https://github.com/f-person/git-blame.nvim