my preferences

This commit is contained in:
Fred Klassen 2023-02-05 14:09:45 -08:00
commit 2a5b839df3
No known key found for this signature in database
GPG key ID: E9E2149793BDE17E
3 changed files with 205 additions and 2 deletions

54
custom/aliases.zsh Normal file
View file

@ -0,0 +1,54 @@
# Aliases in this file are bash and zsh compatible
oh-my-zsh=$HOME/.oh-my-zsh
# Get operating system
platform='unknown'
unamestr=$(uname)
if [[ $unamestr == 'Linux' ]]; then
platform='linux'
elif [[ $unamestr == 'Darwin' ]]; then
platform='darwin'
fi
# PS
alias psa="ps aux"
alias psg="ps aux | grep "
# Moving around
alias cdb='cd -'
alias cls='clear;ls'
# Show human friendly numbers and colors
alias df='df -h'
alias du='du -h -d 2'
if [[ $platform == 'darwin' ]]; then
alias meld='/Applications/Meld.app/Contents/MacOS/Meld'
alias code='/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code'
# Homebrew
alias brewu='brew update && brew upgrade && brew cleanup && brew doctor'
fi
# Alias Editing
TRAPHUP() {
source $oh-my-zsh/custom/aliases.zsh
}
alias ae='vim $oh-my-zsh/custom/aliases.zsh' #alias edit
alias arl='source $oh-my-zsh/custom/aliases.zsh' #alias reload
alias gar="killall -HUP -u \"$USER\" zsh" #global alias reload
# vim using
mvim --version > /dev/null 2>&1
MACVIM_INSTALLED=$?
if [ $MACVIM_INSTALLED -eq 0 ]; then
alias vim="mvim -v"
fi
# mimic vim functions
alias :q='exit'
# vimrc editing
alias ve='vim ~/.vimrc'

144
templates/gitconfig Normal file
View file

@ -0,0 +1,144 @@
# set your user tokens as environment variables, such as ~/.secrets
# See the README for examples.
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red
new = green
[alias]
# add
a = add # add
chunkyadd = add --patch # stage commits chunk by chunk
# Shows list of contributors of a repository.
contributors = shortlog --summary --numbered --email
# via http://philjackson.github.io/2013/04/07/handy-git-tips-to-stop-you-getting-fired.html
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
snapshots = !git stash list --grep snapshot
#via http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
recent-branches = !git for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(refname:short)'
# branch
b = branch -v # branch (verbose)
# commit
c = commit -m # commit with message
ca = commit -am # commit all with message
ci = commit # commit
amend = commit --amend # ammend your last commit
ammend = commit --amend # ammend your last commit
# checkout
co = checkout # checkout
nb = checkout -b # create and switch to a new branch (mnemonic: "git new branch branchname...")
# cherry-pick
cp = cherry-pick -x # grab a change from a branch
# diff
diff = diff --ignore-space-at-eol -b -w --ignore-blank-lines
d = diff # diff unstaged changes
dc = diff --cached # diff staged changes
last = diff HEAD^ # diff last committed change
# log
l = log --graph --date=short
changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status
short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
simple = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
# pull
pl = pull # pull
# push
ps = push # push
# rebase
rc = rebase --continue # continue rebase
rs = rebase --skip # skip rebase
# remote
r = remote -v # show remotes (verbose)
update = !git fetch upstream && git rebase upstream/`git rev-parse --abbrev-ref HEAD`
# reset
unstage = reset HEAD # remove files from index (tracking)
uncommit = reset --soft HEAD^ # go back before last commit, with files in uncommitted state
filelog = log -u # show changes to a file
dt = difftool # fire up the diff tool
mt = mergetool # fire up the merge tool
# stash
ss = stash # stash changes
sl = stash list # list stashes
sa = stash apply # apply stash (restore changes)
sd = stash drop # drop stashes (destory changes)
# status
s = status # status
st = status # status
stat = status # status
# tag
t = tag -n # show tags with <n> lines of each tag message
# svn helpers
svnr = svn rebase
svnd = svn dcommit
svnl = svn log --oneline --show-commit
[fetch]
fetch = +refs/tags/*:refs/tags/*
[format]
pretty = format:%C(blue)%ad%Creset %C(yellow)%h%C(green)%d%Creset %C(blue)%s %C(magenta) [%an]%Creset
[difftool]
prompt = false
[difftool "meld"]
keepbackup=false
[mergetool]
prompt = false
#[mergetool "mvimdiff"]
#cmd="mvim -c 'Gdiff' $MERGED" # use fugitive.vim for 3-way merge
[mergetool "meld"]
keepbackup=false
[merge]
summary = true
verbosity = 1
#tool = mvimdiff
tool = meld
[apply]
whitespace = nowarn
[branch]
autosetupmerge = true
[push]
# 'git push' will push the current branch to its tracking branch
# the usual default is to push all branches
default = upstream
[core]
autocrlf = false
editor = vim
excludesfile = ~/.yadr/git/gitignore
[advice]
statusHints = false
[diff]
# Git diff will use (i)ndex, (w)ork tree, (c)ommit and (o)bject
# instead of a/b/c/d as prefixes for patches
mnemonicprefix = true
algorithm = patience
[rerere]
# Remember my merges
# http://gitfu.wordpress.com/2008/04/20/git-rerere-rereremember-what-you-did-last-time/
enabled = true
[include]
path = .gitconfig.user
[gpg]
program = gpg
[commit]
gpgsign = true

View file

@ -8,7 +8,7 @@ export ZSH=$HOME/.oh-my-zsh
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
ZSH_THEME="gnzh"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
@ -70,7 +70,12 @@ ZSH_THEME="robbyrussell"
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
plugins=(
git
alias-finder
aliases
fasd
)
source $ZSH/oh-my-zsh.sh