diff --git a/git/commit-template.txt b/git/commit-template.txt new file mode 100644 index 0000000..7a9c3b7 --- /dev/null +++ b/git/commit-template.txt @@ -0,0 +1,8 @@ +# feat: +# fix: +# chore: +# docs: +# style: +# refactor: +# test: +# ci: diff --git a/git/config b/git/config new file mode 100644 index 0000000..4e58f4b --- /dev/null +++ b/git/config @@ -0,0 +1,75 @@ +[user] + name = "Martin Larsson" + +[core] + compression = 9 + whitespace = error + preloadindex = true + +[status] + branch = true + showStash = true + showUntrackedFiles = all + +[diff] + context = 3 + renames = copies + interHunkContext = 10 + +[pager] + diff = diff-so-fancy | $PAGER + +[diff-so-fancy] + markEmptyLines = fales + +[interactive] + singleKey = true + +[push] + autoSetupRemote = true + default = current + followTags = true + +[pull] + default = current + rebase = true + +[rebase] + autoStash = true + missingCommitsCheck = true + +[log] + abbrevCommit = true + graphColors = blue,yellow,cyan,magenta,green,red + +[branch] + sort = -committerdate + +[tag] + sort = -taggerdate + +[color "diff"] + meta = black bold + frag = magenta + context = white + whitespace = yellow reverse + old = red + +[color "decorate"] + HEAD = red + branch = blue + tag = yellow + remoteBranch = magenta + +[color "branch"] + current = magenta + local = default + remote = yellow + upstream = green + plain = blue + +[url "git@github.com:"] + insteadOf = "gh:" + +[url "git@gitlabs.com:"] + insteadOf = "gl:" diff --git a/nix/home/default.nix b/nix/home/default.nix index 128cb64..bad4cf3 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -48,6 +48,10 @@ let ".config/wallpapers" "wallpapers" ] + [ + ".config/git" + "git" + ] ]; codelldb = pkgs.runCommand "codelldb" { } '' @@ -111,6 +115,7 @@ in bc cmatrix svelte-language-server + diff-so-fancy ]; file = utils.mk_symlinks { inherit config dotfiles; }; diff --git a/zsh/.zshrc b/zsh/.zshrc index 9c1604b..eef0b52 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -134,11 +134,25 @@ else alias wlc="wl-copy" alias wlp="wl-paste" fi -alias pilot="gh copilot" -alias ps="gh copilot suggest" -alias pe="gh copilot explain" alias fzfd="fd --type d --hidden --follow --exclude .git | fzf" +alias gs="clear -x; git status -sb; echo ""; git --no-pager log --oneline -4" +alias gsu="git submodule update --init --recursive --force" +alias gc="git commit --verbose --template=$HOME/.config/git/commit-template.txt" +alias gp="git push" +alias gu="git pull" +alias gsw="git switch" +alias gswc="git switch --create" +alias gb="git branch" +alias gr="git restore --staged" +alias gre="git restore" +alias ga="git add" +alias gap="git add --patch" +alias gi="git init" +alias gcl="git clone" +alias gd="git diff --output-indicator-new=' ' --output-indicator-old=' '" +alias gl="git log --all --graph --pretty=format:'%C(magenta)%h %C(white) %an %ar%C(auto) %D%n%s%n'" + # Alias functions vif() { nvim "$(fzf)"