fix: add git alias

This commit is contained in:
2024-06-11 17:53:43 +08:00
parent 7bb20c64e2
commit a9f48d2d59
2 changed files with 27 additions and 20 deletions
+1
View File
@@ -40,6 +40,7 @@
bn = branch --no-merged bn = branch --no-merged
pl = pull pl = pull
pt = push origin --tags pt = push origin --tags
ph = push origin HEAD
merge2 = !sh -c '_CURRENT_BRANCH=$(git symbolic-ref --short HEAD) && git checkout $1 && git merge $_CURRENT_BRANCH && git checkout $_CURRENT_BRANCH' - merge2 = !sh -c '_CURRENT_BRANCH=$(git symbolic-ref --short HEAD) && git checkout $1 && git merge $_CURRENT_BRANCH && git checkout $_CURRENT_BRANCH' -
bg = "!f() { git branch | grep $1; }; f" bg = "!f() { git branch | grep $1; }; f"
delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f" delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f"
+26 -20
View File
@@ -4,25 +4,30 @@ return {
opts = { opts = {
signs = { signs = {
-- TODO add hl to colorscheme -- TODO add hl to colorscheme
add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, changedelete = {
}, hl = "GitSignsChange",
numhl = false, text = "▎",
linehl = false, numhl = "GitSignsChangeNr",
watch_gitdir = { linehl = "GitSignsChangeLn",
interval = 1000 },
}, },
sign_priority = 6, numhl = false,
update_debounce = 200, linehl = false,
status_formatter = nil, -- Use default watch_gitdir = {
interval = 1000,
},
sign_priority = 6,
update_debounce = 200,
status_formatter = nil, -- Use default
on_attach = function(buffer) on_attach = function(buffer)
local gs = package.loaded.gitsigns local gs = package.loaded.gitsigns
local function map(mode, l, r, desc) local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end end
-- stylua: ignore start -- stylua: ignore start
@@ -38,7 +43,8 @@ return {
map("n", "<leader>ghd", gs.diffthis, "Diff This") map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~") map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk") map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
end, end,
} },
} },
} }