Port the live ~/.config/nvim working tree (bcherb2/nvim master plus its uncommitted git.lua and minimap.lua edits): adds claudecode, eslint, lsp, typescript, meow-yarn and refactoring-fix specs, drops the files the live repo deleted, and takes live for everything else. Kept from public: lazy.lua with luarocks disabled, the ai_assist cond guard (nvim-ai-assist is not anonymously clonable, so a fresh box only gets it from the private clone list), and the scrubbed endpoint comment in place of live's LAN address.
88 lines
3.5 KiB
Lua
88 lines
3.5 KiB
Lua
-- Git enhancement plugins
|
|
--
|
|
-- Change markers and blame both come from gitsigns.nvim (LazyVim's default; the
|
|
-- editor.mini-diff extra is off in lazyvim.json because it disables gitsigns).
|
|
local MIN_BLAME_ROOM = 12 -- columns needed before the summary is worth showing
|
|
local blame_hl = "GitSignsCurrentLineBlame"
|
|
|
|
-- Current-line blame that fits the window: "author, 3 days ago · summary". The
|
|
-- summary is cut to the room left after the line's text, and dropped when the
|
|
-- line nearly fills the window, so the annotation never runs off screen.
|
|
local function blame_formatter(_, info)
|
|
if info.author == "Not Committed Yet" then
|
|
return { { " ● Uncommitted change", "GitSignsChange" } }
|
|
end
|
|
local util = require("gitsigns.util")
|
|
local head = (" %s, %s"):format(info.author, util.get_relative_time(tonumber(info.author_time)))
|
|
|
|
local win = vim.api.nvim_get_current_win()
|
|
local textoff = vim.fn.getwininfo(win)[1].textoff
|
|
local room = vim.api.nvim_win_get_width(win) - textoff
|
|
- vim.api.nvim_strwidth(vim.api.nvim_get_current_line()) - vim.api.nvim_strwidth(head) - 4
|
|
if room < MIN_BLAME_ROOM then
|
|
return { { head, blame_hl } }
|
|
end
|
|
local summary = info.summary or ""
|
|
if vim.api.nvim_strwidth(summary) > room then
|
|
summary = vim.fn.strcharpart(summary, 0, room - 1) .. "…"
|
|
end
|
|
return { { head, blame_hl }, { " · " .. summary, blame_hl } }
|
|
end
|
|
|
|
return {
|
|
{
|
|
"lewis6991/gitsigns.nvim",
|
|
opts = {
|
|
-- Heavy bars in the sign column, VS Code style. Unstaged changes use
|
|
-- GitSignsAdd/Change/Delete; staged ones get gitsigns' dimmer variants.
|
|
signs = {
|
|
add = { text = "┃" },
|
|
change = { text = "┃" },
|
|
delete = { text = "▁" },
|
|
topdelete = { text = "▔" },
|
|
changedelete = { text = "┃" },
|
|
untracked = { text = "┆" },
|
|
},
|
|
signs_staged = {
|
|
add = { text = "┃" },
|
|
change = { text = "┃" },
|
|
delete = { text = "▁" },
|
|
topdelete = { text = "▔" },
|
|
changedelete = { text = "┃" },
|
|
},
|
|
numhl = true, -- also color the line number of every changed line
|
|
attach_to_untracked = true,
|
|
current_line_blame = true,
|
|
current_line_blame_opts = { virt_text_pos = "eol", delay = 300, ignore_whitespace = true },
|
|
current_line_blame_formatter = blame_formatter,
|
|
current_line_blame_formatter_nc = blame_formatter,
|
|
},
|
|
keys = {
|
|
{ "<leader>gb", "<cmd>Gitsigns blame<cr>", desc = "Blame panel (every line)" },
|
|
{ "<leader>gL", function() require("gitsigns").blame_line({ full = true }) end, desc = "Blame line (full commit)" },
|
|
{ "<leader>uB", "<cmd>Gitsigns toggle_current_line_blame<cr>", desc = "Toggle inline blame" },
|
|
{ "<leader>uN", "<cmd>Gitsigns toggle_numhl<cr>", desc = "Toggle git line-number colors" },
|
|
},
|
|
},
|
|
|
|
-- Advanced git diff viewer
|
|
-- Better git diff interface with file history
|
|
-- Open with :DiffviewOpen, :DiffviewFileHistory
|
|
{
|
|
"sindrets/diffview.nvim",
|
|
cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles", "DiffviewFileHistory" },
|
|
opts = {
|
|
enhanced_diff_hl = true,
|
|
view = {
|
|
default = { layout = "diff2_horizontal" },
|
|
file_history = { layout = "diff2_horizontal" },
|
|
},
|
|
},
|
|
keys = {
|
|
{ "<leader>gd", "<cmd>DiffviewOpen<cr>", desc = "Open Diffview" },
|
|
{ "<leader>gh", "<cmd>DiffviewFileHistory %<cr>", desc = "File History" },
|
|
{ "<leader>gH", "<cmd>DiffviewFileHistory<cr>", desc = "Repo History" },
|
|
},
|
|
},
|
|
}
|