A Neovim plugin that shows deleted git lines as inline virtual text below the deletion point.
- Inline Display: Shows deleted lines as red virtual text directly in your buffer
- Gitsigns Integration: Uses gitsigns.nvim as the diff data source (unstaged changes only)
- Smart Collapsing: Automatically collapses hunks with >100 deleted lines
- Easy Navigation: Toggle display and expand collapsed hunks with simple keybindings
- Minimal Configuration: Works out of the box with sensible defaults
│ 3 │ function M.setup(opts) │ <- real line
│ ╌╌╌ │ - function M.setup() │ <- virtual (red)
│ 4 │ M.config = opts or {} │ <- real line
│ ╌╌╌ │ - M.config = {} │ <- virtual (red)
- Neovim >= 0.10
- gitsigns.nvim
{
"username/inline-deleted.nvim",
dependencies = { "lewis6991/gitsigns.nvim" },
event = { "BufReadPost", "BufNewFile" },
opts = {},
keys = {
{ "<leader>gi", function() require("inline-deleted").toggle() end, desc = "Toggle inline deleted" },
{ "<leader>ge", function() require("inline-deleted").expand() end, desc = "Expand deleted hunk" },
},
}use {
"username/inline-deleted.nvim",
requires = { "lewis6991/gitsigns.nvim" },
config = function()
require("inline-deleted").setup()
end
}Default configuration:
require("inline-deleted").setup({
enabled = true, -- Enable on startup
prefix = "- ", -- Prefix for deleted lines
line_marker = "╌╌╌ ", -- Marker shown in line number column area
max_lines_expanded = 100, -- Collapse hunks larger than this
debounce_ms = 150, -- Debounce refresh to avoid excessive updates
keymaps = {
toggle = "<leader>gi", -- Toggle inline deleted display
expand = "<leader>ge", -- Expand collapsed hunk at cursor
},
exclude_filetypes = { -- Don't activate in these filetypes
"NvimTree",
"neo-tree",
"help",
"fugitive",
"git",
},
})| Command | Description |
|---|---|
:InlineDeletedToggle |
Toggle display on/off |
:InlineDeletedRefresh |
Force refresh |
:InlineDeletedExpand |
Expand hunk at cursor |
| Key | Action |
|---|---|
<leader>gi |
Toggle inline deleted display |
<leader>ge |
Expand collapsed hunk at cursor |
- Make changes to a git-tracked file
- Deleted lines automatically appear as red virtual text below the deletion point
- If a hunk has >100 deleted lines, it shows a collapsed indicator
- Press
<leader>gewhile on a collapsed hunk to expand it - Toggle the entire feature with
<leader>gi
Customize colors by setting these highlight groups:
vim.api.nvim_set_hl(0, "InlineDeleted", { fg = "#ff6b6b" })
vim.api.nvim_set_hl(0, "InlineDeletedMarker", { fg = "#666666" })
vim.api.nvim_set_hl(0, "InlineDeletedCollapsed", { fg = "#888888", italic = true })- Diff Source: Integrates with gitsigns.nvim to get unstaged changes
- Virtual Text: Uses Neovim's extmark API with
virt_linesto render deleted lines - Auto-Refresh: Automatically updates on buffer changes, saves, and gitsigns updates
- State Management: Tracks collapsed/expanded state per buffer and hunk
lua/inline-deleted/
├── init.lua # Public API, commands, keymaps
├── constants.lua # Highlight groups, namespace
├── state.lua # Per-buffer state management
├── hunks.lua # Gitsigns integration
├── render.lua # Extmark rendering
└── health.lua # :checkhealth support
Run :checkhealth inline-deleted to verify your setup. This checks:
- Neovim version (>= 0.10 required)
- gitsigns.nvim installation
- gitsigns cache API availability
local inline_deleted = require("inline-deleted")
-- Setup with custom config
inline_deleted.setup(opts)
-- Toggle display on/off
inline_deleted.toggle()
-- Expand collapsed hunk at cursor
inline_deleted.expand()MIT