diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..e3c0a29 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,27 @@ + +# Directory for all-things ZSH config +zsh_dir=${${ZDOTDIR}:-$HOME/.config/zsh} + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# Import alias files +source ${zsh_dir}/aliases/git.zsh + +# Setup Antigen bundle manager +source ${zsh_dir}/helpers/setup-antigen.zsh + +# Then import Antigen plugins +source ${zsh_dir}/helpers/import-plugins.zsh + +# Enable auto-completion +autoload -Uz compinit +typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null) +if [ $(date +'%j') != $updated_at ]; then + compinit -i +else + compinit -C -i +fi + +# Import P10k config for command prompt, run `p10k configure` or edit +[[ ! -f ${zsh_dir}/.p10k.zsh ]] || source ${zsh_dir}/.p10k.zsh diff --git a/zsh/aliases/git.zsh b/zsh/aliases/git.zsh new file mode 100644 index 0000000..2bb7c6c --- /dev/null +++ b/zsh/aliases/git.zsh @@ -0,0 +1,50 @@ +# List of ZSH aliases for common git commands +# Licensed under MIT - (C) Alicia Sykes, 2022 + +# Basics +alias g="git" +alias gs="git status" # List changed files +alias ga="git add" # Add to the next commit +alias gaa="git add ." # Add all changed files +alias grm="git rm" # Remove +alias gc="git commit" # Commit staged files, needs -m "" +alias gps="git push" # Push local commits to +alias gpl="git pull" # Pull changes with +alias gf="git fetch" # Download branch changes, without modifying files + +# Merging and Rebasing +alias grb="git rebase" # Rebase the current HEAD into +alias grba="git rebase --abort" # Cancel current rebase sesh +alias grbc="git rebase --continue" # Continue onto next diff +alias gm="git merge" # Merge into your current HEAD + +# Repo setup +alias gi="git init" # Initiialize a new empty local repo +alias gcl="git clone" # Downloads repo from + +# Branching +alias gch="git checkout" # Switch the HEAD to +alias gb="git branch" # Create a new from HEAD +alias gd="git diff" # Show all changes to untracked files +alias gtree="git log --graph --oneline --decorate" # Show branch tree + +# Tags +alias gt="git tag" # Tag the current commit, 1 param +alias gtl="git tag -l" # List all tags, optionally with pattern +alias gtlm="git tag -n" # List all tags, with their messages +alias gtp="git push --tags" # Publish tags + +# Origin +alias gr="git remote" +alias grs="git remote show" # Show current remote origin +alias grl="git remote -v" # List all currently configured remotes +alias grr="git remote rm origin" # Remove current origin +alias gra="git remote add" # Add new remote origin +alias grurl="git remote set-url origin" # Sets URL of existing origin + +# Undoing +alias guc="git revert" # Revert a +alias gu="git reset" # Reset HEAD pointer to a , perserves changes +alias gua="git reset --hard HEAD" # Resets all uncommited changes +alias gnewmsg="git commit --amend -m" # Update of previous commit +alias gclean="git clean -df" # Remove all untracked files