From a286817ce3ac826c9adbef6c8164068820d813d5 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Tue, 23 Dec 2025 18:53:05 +0200 Subject: [PATCH] feat: git --- files/home/.gitconfig | 144 ++++++++++++++++++------------------------ files/home/.vimrc | 17 +++-- 2 files changed, 71 insertions(+), 90 deletions(-) diff --git a/files/home/.gitconfig b/files/home/.gitconfig index 235892c..7549aa4 100644 --- a/files/home/.gitconfig +++ b/files/home/.gitconfig @@ -3,91 +3,69 @@ email = git@andrejus.uk [github] -user = andrejusk + user = andrejusk + +[credential] + helper = + [credential "https://github.com"] - helper = - helper = !/usr/bin/gh auth git-credential + helper = !/usr/bin/env gh auth git-credential + [credential "https://gist.github.com"] - helper = - helper = !/usr/bin/gh auth git-credential + helper = !/usr/bin/env gh auth git-credential + +[init] + defaultBranch = master + +[core] + autocrlf = input + editor = vim + pager = less -FRX + +[color] + ui = auto + +[color "status"] + added = 42 + changed = 226 + untracked = 196 + branch = 45 +[color "diff"] + meta = 91 + frag = 45 + old = 196 + new = 42 + context = 252 +[color "branch"] + current = 45 + local = 252 + remote = 27 +[color "decorate"] + branch = 45 + remoteBranch = 27 + tag = 226 + stash = 201 [alias] -# List aliases -la = "!git config -l | grep alias | cut -c 7-" + l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short + ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate + ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat + ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative + le = log --oneline --decorate + lg = log --graph --decorate --oneline + d = diff + ds = diff --stat + dc = diff --cached + s = status -s + b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'" + a = add + ap = add -p + c = commit --verbose + ca = commit -a --verbose + cm = commit -m + cam = commit -a -m + m = commit --amend --verbose + st = stash + sa = stash apply + stl = stash list -# Logging aliases -l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short -ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate -ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat -lnc = log --pretty=format:"%h\\ %s\\ [%cn]" -lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short -ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative -le = log --oneline --decorate - -# Repo aliases -filelog = log -u -fl = log -u -dl = "!git ll -1" -dlc = diff --cached HEAD^ -dr = "!f() { git diff "$1"^.."$1"; }; f" -lc = "!f() { git ll "$1"^.."$1"; }; f" -diffr = "!f() { git diff "$1"^.."$1"; }; f" - -d = dif -ds = diff --stat -dc = diff --cached -f = "!git ls-files | grep -i" - -grep = grep -Ii -gr = grep -Ii -gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f" - -rl = ref log - -cl = clone -rao = remote add origin -pushitgood = push -u origin --all - -r = reset -r1 = reset HEAD^ -r2 = reset HEAD^^ -rh = reset --hard -rh1 = reset HEAD^ --hard -rh2 = reset HEAD^^ --hard - -lasttag = describe --tags --abbrev=0 -lt = describe --tags --abbrev=0 - -# Branch aliases -s = status -s -co = checkout -cob = checkout -b -com = checkout master -# list branches sorted by last modified -b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'" - -# File aliases -a = add -ap = add -p - -c = commit --verbose -ca = commit -a --verbose -cm = commit -m -cam = commit -a -m -m = commit --amend --verbose - -ac = !git add . && git commit -am -ours = "!f() { git co --ours $@ && git add $@; }; f" -theirs = "!f() { git co --theirs $@ && git add $@; }; f" - -# Ignore files -assume = update-index --assume-unchanged -unassume = update-index --no-assume-unchanged -assumed = "!git ls-files -v | grep ^h | cut -c 3-" -unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged" -assumeall = "!git st -s | awk {'print $2'} | xargs git assume" - -# Stash aliases -st = stash -sa = stash apply -stl = stash list diff --git a/files/home/.vimrc b/files/home/.vimrc index 9d606a8..d16e2d2 100644 --- a/files/home/.vimrc +++ b/files/home/.vimrc @@ -69,7 +69,7 @@ highlight CursorLineNr guifg=#FCFC38 guibg=NONE gui=bold highlight StatusLine guifg=#CCE0D0 guibg=#000080 gui=bold highlight StatusLineNC guifg=#808080 guibg=#000080 gui=NONE highlight VertSplit guifg=#808080 guibg=NONE -highlight ColorColumn guibg=#703014 +highlight ColorColumn guibg=#2A1A0A highlight Comment guifg=#808080 gui=italic highlight Constant guifg=#F88C14 @@ -88,10 +88,10 @@ highlight Todo guifg=#FCFC38 guibg=NONE gui=bold highlight Search guifg=#3C3C3C guibg=#FCFC38 highlight IncSearch guifg=#3C3C3C guibg=#F88C14 -highlight DiffAdd guifg=NONE guibg=#2CB494 -highlight DiffDelete guifg=NONE guibg=#F40404 -highlight DiffChange guifg=NONE guibg=#0C48CC -highlight DiffText guifg=NONE guibg=#88409C gui=bold +highlight DiffAdd guifg=#2CB494 guibg=#0A2A1A gui=NONE +highlight DiffDelete guifg=#F40404 guibg=#2A0A0A gui=NONE +highlight DiffChange guifg=#4068D4 guibg=#0A1A2A gui=NONE +highlight DiffText guifg=#CCE0D0 guibg=#1A2A3A gui=bold highlight diffAdded guifg=#2CB494 gui=bold highlight diffRemoved guifg=#F40404 gui=bold @@ -104,12 +104,15 @@ highlight SpellBad guifg=#F40404 gui=undercurl guisp=#F40404 highlight SpellCap guifg=#FCFC38 gui=undercurl guisp=#FCFC38 highlight SpellRare guifg=#88409C gui=undercurl guisp=#88409C -highlight Visual guibg=#4068D4 +highlight Visual guibg=#1A3050 highlight Pmenu guifg=#CCE0D0 guibg=#000080 highlight PmenuSel guifg=#3C3C3C guibg=#2CB494 gui=bold -highlight QuickFixLine guibg=#4068D4 gui=bold +highlight Folded guifg=#808080 guibg=#1A1A1A gui=NONE +highlight FoldColumn guifg=#808080 guibg=NONE + +highlight QuickFixLine guibg=#1A3050 gui=bold function! GitRoot() let l:root = systemlist('git rev-parse --show-toplevel')[0]