A simple plugin for viewing git blame info, inspired by GitLens
MIT License
Inspired by VSCode and GitLens, this plugin simply adds blame info as virtual text to the end of your current line. Written in Rust using git2
and nvim-utils
.
Install using your favorite package manager
{
'willothy/blam.nvim',
build = 'make',
opts = {
-- options
},
config = true
}
use('willothy/blam.nvim', {
run = 'make',
config = function()
require("blam").setup({
-- options
})
end
})
Blam includes no mappings, just a few functions:
-- Toggles line blame (will update as you move the cursor)
require("blam").toggle()
-- Peeks the blame for the current line (will disappear when cursor is moved or after a timeout)
require("blam").peek()
Here's my setup:
{
'willothy/blam.nvim',
build = 'make',
config = true,
init = function()
vim.keymap.set("n", "<leader>b", require("blam").peek)
end
}
Blam comes with the following defaults:
{
-- Can be a hex color
-- or a table with fg and bg colors
-- or a highlight group
hl = "Comment",
-- Timeout before peek blame disappears
-- Set to 0 to disable and only hide peek blame on cursor move
peek_timeout = 0,
-- Whether line blame will be enabled on startup
-- Disabled by defauly as it can be a bit intrusive (I prefer using peek)
enabled = false,
}