mirror of
https://git.aramjonghu.dev/AramJonghu/nvim.git
synced 2026-09-01 23:43:31 +02:00
80 lines
2.3 KiB
Lua
80 lines
2.3 KiB
Lua
local function on_attach(bufnr)
|
|
local gs = require "gitsigns"
|
|
|
|
local function map(mode, lhs, rhs, desc)
|
|
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, desc = desc })
|
|
end
|
|
|
|
map("n", "]g", function()
|
|
if vim.wo.diff then return "]g" end
|
|
vim.schedule(function() gs.next_hunk() end)
|
|
return "<Ignore>"
|
|
end, "Next hunk")
|
|
|
|
map("n", "[g", function()
|
|
if vim.wo.diff then return "[g" end
|
|
vim.schedule(function() gs.prev_hunk() end)
|
|
return "<Ignore>"
|
|
end, "Prev hunk")
|
|
|
|
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
|
|
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
|
|
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
|
|
map("n", "<leader>hb", gs.blame_line, "Blame line")
|
|
map("n", "<leader>hd", gs.diffthis, "Diff this")
|
|
map("n", "<leader>hD", function() gs.diffthis "~" end, "Diff against ~")
|
|
map("n", "<leader>htb", gs.toggle_current_line_blame, "Toggle line blame")
|
|
map("n", "<leader>htd", gs.toggle_deleted, "Toggle deleted")
|
|
end
|
|
|
|
require("gitsigns").setup {
|
|
on_attach = on_attach,
|
|
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 = "~" },
|
|
untracked = { text = "┆" },
|
|
},
|
|
signs_staged_enable = true,
|
|
signcolumn = true,
|
|
numhl = false,
|
|
linehl = false,
|
|
word_diff = false,
|
|
watch_gitdir = {
|
|
follow_files = true,
|
|
},
|
|
auto_attach = true,
|
|
attach_to_untracked = false,
|
|
current_line_blame = false,
|
|
current_line_blame_opts = {
|
|
virt_text = true,
|
|
virt_text_pos = "eol",
|
|
delay = 1000,
|
|
ignore_whitespace = false,
|
|
virt_text_priority = 100,
|
|
use_focus = true,
|
|
},
|
|
current_line_blame_formatter = "<author>, <author_time:%R> - <summary>",
|
|
blame_formatter = nil,
|
|
sign_priority = 6,
|
|
update_debounce = 100,
|
|
status_formatter = nil,
|
|
max_file_length = 40000,
|
|
preview_config = {
|
|
style = "minimal",
|
|
relative = "cursor",
|
|
row = 0,
|
|
col = 1,
|
|
},
|
|
}
|