update git diff

This commit is contained in:
Alexander Navarro 2025-02-27 11:55:54 -03:00
parent 769700b5ec
commit da22992983
4 changed files with 77 additions and 37 deletions

View file

@ -5,6 +5,8 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.o.diffopt = "vertical,closeoff,filler"
local opt = vim.opt
-- stylua: ignore

View file

@ -2,36 +2,55 @@ return { -- Change colors.none if not using a transparent background
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
opts = {
flavour = "macchiato",
transparent_background = true,
integrations = {
aerial = true,
blink_cmp = true,
cmp = true,
harpoon = false,
indent_blankline = { enabled = true, scope_color = "text", },
lsp_trouble = true,
mason = true,
neogit = true,
noice = true,
notify = true,
},
custom_highlights = function(colors)
return {
-- Fix colors for cmp
Pmenu = { bg = colors.none, blend = 0 },
FloatBorder = { bg = colors.none },
CmpItemMenu = { fg = colors.text, bg = colors.none },
-- dadbod-ui
NotificationInfo = { bg = colors.none, fg = colors.text },
NotificationWarning = { bg = colors.none, fg = colors.yellow },
NotificationError = { bg = colors.none, fg = colors.red },
}
end,
},
config = function()
local utils = require("catppuccin.utils.colors")
local opts = {
flavour = "macchiato",
transparent_background = true,
integrations = {
aerial = true,
blink_cmp = true,
cmp = true,
gitsigns = true,
indent_blankline = { enabled = true, scope_color = "text", },
lsp_trouble = true,
mason = true,
noice = true,
notify = true,
},
custom_highlights = function(colors)
return {
-- Fix colors for cmp
Pmenu = { bg = colors.none, blend = 0 },
FloatBorder = { bg = colors.none },
CmpItemMenu = { fg = colors.text, bg = colors.none },
-- dadbod-ui
NotificationInfo = { bg = colors.none, fg = colors.text },
NotificationWarning = { bg = colors.none, fg = colors.yellow },
NotificationError = { bg = colors.none, fg = colors.red },
-- for word diff in previews
GitSignsAddInline = {
fg = colors.teal,
bg = utils.darken(colors.teal, 0.4),
style = { "bold" },
},
GitSignsDeleteInline = {
fg = colors.red,
bg = utils.darken(colors.red, 0.4),
style = { "bold" },
},
GitSignsChangeInline = {
fg = colors.mauve,
bg = utils.darken(colors.mauve, 0.4),
style = { "bold" },
},
GitSignsDeleteVirtLn = { bg = colors.none, fg = colors.red },
}
end,
}
config = function(_, opts)
require("catppuccin").setup(opts)
vim.cmd.colorscheme("catppuccin-macchiato")
end,

View file

@ -1,18 +1,32 @@
local const = require("aleidk.constants")
return {
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
signs = {
add = { text = const.icons.git.added },
change = { text = const.icons.git.modified },
delete = { text = const.icons.git.removed },
topdelete = { text = const.icons.git.removed },
changedelete = { text = const.icons.git.removed },
untracked = { text = "" },
},
on_attach = function(buffer)
signs_staged = {
add = { text = const.icons.git.added },
change = { text = const.icons.git.modified },
delete = { text = const.icons.git.removed },
topdelete = { text = const.icons.git.removed },
changedelete = { text = const.icons.git.removed },
untracked = { text = "" },
},
on_attach = function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
@ -28,7 +42,10 @@ return {
map("n", "R", gs.reset_buffer, "Reset Buffer")
map("n", "<TAB>", gs.preview_hunk, "Preview Hunk")
map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "d", gs.diffthis, "Diff This")
map("n", "L", gs.toggle_current_line_blame, "Toggle current line blame")
map("n", "d", gs.toggle_word_diff, "Toggle word diff")
map("n", "h", "<CMD>diffget<CR>", "Diff This with last commit")
map("n", "l", "<CMD>diffput<CR>", "Diff This with last commit")
end,
},
},

View file

@ -41,6 +41,8 @@ prepend_keymap = [
{ on = ["g", "<Space>"], run = "cd --interactive", desc = "Go to a directory interactively" },
]
[input]
keymap = [{ on = ["<Esc>"], run = "escape --all", desc = "Go back the normal mode, or cancel input" }]
[help]
prepend_keymap = [{ on = "q", run = "escape", desc = "Clear the filter, or hide the help" }]