Skip to content

willothy/blam.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blam

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.

BlamDemo.mp4

Installation

Install using your favorite package manager

Lazy.nvim

{
    'willothy/blam.nvim',
    build = 'make',
    opts = {
        -- options
    },
    config = true
}

Packer.nvim

use('willothy/blam.nvim', {
    run = 'make',
    config = function()
        require("blam").setup({
            -- options
        })
    end
})

Usage

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
}

Configuration

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,
}

About

A simple plugin for viewing git blame info, inspired by GitLens

Resources

License

Stars

Watchers

Forks