update git diff

This commit is contained in:
Harivansh Rathi 2025-11-29 01:07:44 -08:00
parent 1c9349e5c5
commit 22f09a3487
2 changed files with 26 additions and 15 deletions

View file

@ -44,9 +44,15 @@ return {
"sindrets/diffview.nvim", "sindrets/diffview.nvim",
cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles" }, cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles" },
config = function() config = function()
-- Set up diff highlights before loading diffview
vim.api.nvim_set_hl(0, "DiffAdd", { bg = "#2a3a2a" })
vim.api.nvim_set_hl(0, "DiffChange", { bg = "#3a3a2a" })
vim.api.nvim_set_hl(0, "DiffDelete", { bg = "#3a2a2a" })
vim.api.nvim_set_hl(0, "DiffText", { bg = "#5a3d3d" })
require("diffview").setup({ require("diffview").setup({
diff_binaries = false, -- Show diffs for binaries diff_binaries = false, -- Show diffs for binaries
enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl' enhanced_diff_hl = true, -- Better word-level diff highlighting
git_cmd = { "git" }, -- The git executable followed by default args. git_cmd = { "git" }, -- The git executable followed by default args.
use_icons = true, -- Requires nvim-web-devicons use_icons = true, -- Requires nvim-web-devicons
show_help_hints = true, -- Show hints for how to open the help panel show_help_hints = true, -- Show hints for how to open the help panel

View file

@ -3,22 +3,14 @@ return {
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
config = function() config = function()
require("gitsigns").setup({ require("gitsigns").setup({
signs = { -- Disable sign column indicators
add = { text = "" }, signcolumn = false,
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
-- Show colors on line numbers -- Show colors on line numbers
numhl = true, numhl = true,
-- Optional: adds subtle highlighting to the entire line (set to true if you want) -- Highlight the entire line for changed lines (Cursor-style)
linehl = false, linehl = true,
-- Optional: highlight the word that changed -- Highlight the word that changed within a line
word_diff = false, word_diff = true,
-- Make the signs stand out a bit more with custom highlights
signcolumn = true,
-- Show git blame at end of current line (optional, can be distracting) -- Show git blame at end of current line (optional, can be distracting)
current_line_blame = false, current_line_blame = false,
current_line_blame_opts = { current_line_blame_opts = {
@ -32,6 +24,19 @@ return {
border = 'rounded', border = 'rounded',
style = 'minimal', style = 'minimal',
}, },
on_attach = function(bufnr)
-- Set up Cursor-style line highlights (subtle background colors)
-- Green tint for added lines
vim.api.nvim_set_hl(0, "GitSignsAddLn", { bg = "#2a3a2a" })
-- Red tint for removed/changed lines
vim.api.nvim_set_hl(0, "GitSignsChangeLn", { bg = "#3a2a2a" })
vim.api.nvim_set_hl(0, "GitSignsDeleteLn", { bg = "#3a2a2a" })
vim.api.nvim_set_hl(0, "GitSignsChangedeleteLn", { bg = "#3a2a2a" })
-- Word diff highlights (more prominent)
vim.api.nvim_set_hl(0, "GitSignsAddLnInline", { bg = "#3d5a3d" })
vim.api.nvim_set_hl(0, "GitSignsChangeLnInline", { bg = "#5a3d3d" })
vim.api.nvim_set_hl(0, "GitSignsDeleteLnInline", { bg = "#5a3d3d" })
end,
}) })
end, end,
} }