This plugin is not stable yet.
Display git blame
information of functions, structs and classes using Neovim's virt_lines and TreeSitter.
- Lua
- Rust
- C, C++
- Python
- Java
- JavaScript
- LaTeX
use {
'robert-oleynik/git-blame-virt.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require'git-blame-virt'.setup {}
end
}
git-blame-virt can be configured using the setup function. Here is an example with the default settings:
require'git-blame-virt'.setup {
allow_foreign_repos = true,
display = {
commit_hash = true, -- Enable/Disable latest commit hash
commit_summary = true, -- Enable/Disable latest commit summary
commit_committers = true, -- Enable/Disable committers list
max_committer = 3, -- Limit Number of committers display in list
commit_time = true, -- Enable/Disable relative commit time
hi = 'Comment', -- Change Highlight group of default highlight function
fn = function(...)
-- See Custom Display Function
end
},
ft = {
-- Enable/Disable plugin per filetype
lua = true,
java = true,
javascript = true,
latex = true,
python = true,
rust = true,
cpp = true
}
}
require'git-blame-virt'.setup {
-- ...
display = {
-- ...
fn = function(info)
-- Structure of info: {
-- committers = { "<name>", ... },
-- last = {
-- hash = '000...',
-- timestamp = 0,
-- summary = '...',
-- }
-- }
return {
{ '<text>', '<higlight group>' },
-- ...
}
end
}
}
Note: TreeSitter support for that language is required.
Add to your config before calling setup
:
local lang = require'git-blame-virt.lang'
lang.ts_queries['<your language>'] = [[
(class_definition) @node
(function_definition) @node
]]
Please note: @node
is required at the end of each statement.
For Documentation on TreeSitter Queries: see Pattern Matching With Queries