SkillAgentSearch skills...

Gitlineage.nvim

Neovim plugin to view git history for selected lines. Select a range in visual mode and see how it evolved through commits. Navigate commits, yank SHAs, and optionally open full diffs with diffview.nvim.

Install / Use

/learn @LionyxML/Gitlineage.nvim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

logo

gitlineage.nvim

View git history for selected lines in Neovim.

Select a range of lines in visual mode, use the :GitLineage command, or press the keymap in normal mode to see how they evolved through git commits using git log -L.

How it Works

  1. Select a range of lines in visual mode, or just place your cursor on a line.

    demo_1

  2. Press <leader>gl (all bindings are customizable, see the Installation section below), or run :GitLineage. A new split window opens with the git history of the selected lines (or current line if no selection).

    demo_2

  3. Advance through commits with ]c.

    demo_3

  4. Quickly yank the commit SHA with yc.

    demo_4

  5. Go back to previous commits with [c.

    demo_5

  6. If diffview.nvim is installed, open the full commit diff by hitting <CR> on a commit line.

    demo_6

Requirements

Required:

  • Neovim >= 0.7.0
  • Git

Optional:

Installation

lazy.nvim

{
    "lionyxml/gitlineage.nvim",
    dependencies = {
        "sindrets/diffview.nvim", -- optional, for open_diff feature
    },
    config = function()
        require("gitlineage").setup()
    end
}

mini.deps

Using mini.deps:

local add = require("mini.deps").add

add("sindrets/diffview.nvim") -- optional, for open_diff feature
add("lionyxml/gitlineage.nvim")

require("gitlineage").setup()

vim.pack.add() (Neovim >= 0.12)

Using native vim.pack.add():

vim.pack.add({
	"https://github.com/sindrets/diffview.nvim", -- optional, for open_diff feature
	"https://github.com/lionyxml/gitlineage.nvim",
})

require("gitlineage").setup()

vim-plug

call plug#begin()

Plug 'sindrets/diffview.nvim' " optional, for open_diff feature
Plug 'lionyxml/gitlineage.nvim'

call plug#end()

lua require("gitlineage").setup()

Configuration

require("gitlineage").setup({
    split = "auto",       -- "vertical", "horizontal", or "auto"
    keymap = "<leader>gl", -- set to nil to disable default keymap
    keys = {
        close = "q",       -- set to nil to disable
        next_commit = "]c", -- set to nil to disable
        prev_commit = "[c", -- set to nil to disable
        yank_commit = "yc", -- set to nil to disable
        open_diff = "<CR>", -- set to nil to disable (requires diffview.nvim)
    },
})

| Option | Default | Description | | ------------------ | ------------ | -------------------------------------------------------------------------------------------- | | split | auto | How to open the history buffer. auto picks vertical for wide windows, horizontal for tall. | | keymap | <leader>gl | Normal and visual mode keymap. Set to nil to define your own. | | keys.close | q | Close the history buffer. | | keys.next_commit | ]c | Jump to next commit. | | keys.prev_commit | [c | Jump to previous commit. | | keys.yank_commit | yc | Yank commit SHA when on a commit line. | | keys.open_diff | <CR> | Open full commit diff (requires diffview.nvim). |

Custom keymaps

require("gitlineage").setup({
    keymap = "<leader>gh",
    keys = {
        close = "<Esc>",
        next_commit = "<C-n>",
        prev_commit = "<C-p>",
        yank_commit = "y",
        open_diff = "d",
    },
})

Usage

Using the keymap

  1. In normal mode, press <leader>gl to show history for the current line
  2. In visual mode, select lines and press <leader>gl to show history for the selection

Using the command

  • :GitLineage — show history for the current line
  • :'<,'>GitLineage — show history for the visual selection (just type :GitLineage while in visual mode)
  • :10,20GitLineage — show history for an explicit line range

Buffer keymaps

Once the history buffer is open, navigate using:

| Key | Action | | ------ | ---------------------------------------------- | | q | Close the history buffer | | ]c | Jump to next commit | | [c | Jump to previous commit | | yc | Yank commit SHA (on commit line) | | <CR> | Open full commit diff (requires diffview.nvim) |

Health check

Verify your setup:

:checkhealth gitlineage

This checks:

  • Neovim version
  • Git availability
  • Git repository status
  • diffview.nvim availability (optional)
  • Plugin configuration

Documentation

:h gitlineage

License

MIT

Similar Plugins

View on GitHub
GitHub Stars88
CategoryDevelopment
Updated6d ago
Forks1

Languages

Lua

Security Score

95/100

Audited on Mar 22, 2026

No findings