load-time optimizations

This commit is contained in:
Matt Hamilton 2015-12-20 20:41:54 -05:00
parent a632bff0e5
commit b0bf9d2ebc
6 changed files with 285 additions and 283 deletions

View File

@ -1,181 +0,0 @@
#
# Git aliases.
#
#
# Settings
#
# Log
_git_log_medium_format='%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B'
_git_log_oneline_format='%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n'
_git_log_brief_format='%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n'
#
# Aliases
#
# Git
alias g='git'
# Branch (b)
alias gb='git branch'
alias gbc='git checkout -b'
alias gbl='git branch -v'
alias gbL='git branch -av'
alias gbx='git branch -d'
alias gbX='git branch -D'
alias gbm='git branch -m'
alias gbM='git branch -M'
alias gbs='git show-branch'
alias gbS='git show-branch -a'
# Commit (c)
alias gc='git commit --verbose'
alias gca='git commit --verbose --all'
alias gcm='git commit --message'
alias gco='git checkout'
alias gcO='git checkout --patch'
alias gcf='git commit --amend --reuse-message HEAD'
alias gcF='git commit --verbose --amend'
alias gcp='git cherry-pick --ff'
alias gcP='git cherry-pick --no-commit'
alias gcr='git revert'
alias gcR='git reset "HEAD^"'
alias gcs='git show'
alias gcl='git-commit-lost'
alias gcS='git commit -S'
alias gpS='git show --pretty=short --show-signature'
# Conflict (C)
alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"'
alias gCa='git add $(gCl)'
alias gCe='git mergetool $(gCl)'
alias gCo='git checkout --ours --'
alias gCO='gCo $(gCl)'
alias gCt='git checkout --theirs --'
alias gCT='gCt $(gCl)'
# Data (d)
alias gd='git ls-files'
alias gdc='git ls-files --cached'
alias gdx='git ls-files --deleted'
alias gdm='git ls-files --modified'
alias gdu='git ls-files --other --exclude-standard'
alias gdk='git ls-files --killed'
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'
# Fetch (f)
alias gf='git fetch'
alias gfc='git clone'
alias gfm='git pull'
alias gfr='git pull --rebase'
alias gfu='git remote update -p; git merge --ff-only @\{u\}'
# Grep (g)
alias gg='git grep'
alias ggi='git grep --ignore-case'
alias ggl='git grep --files-with-matches'
alias ggL='git grep --files-without-matches'
alias ggv='git grep --invert-match'
alias ggw='git grep --word-regexp'
# Index (i)
alias gia='git add'
alias giA='git add --patch'
alias giu='git add --update'
alias gid='git diff --no-ext-diff --cached'
alias giD='git diff --no-ext-diff --cached --word-diff'
alias gir='git reset'
alias giR='git reset --patch'
alias gix='git rm -r --cached'
alias giX='git rm -rf --cached'
# Log (l)
alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"'
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"'
alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"'
alias glc='git shortlog --summary --numbered'
alias glS='git log --show-signature'
# Merge (m)
alias gm='git merge'
alias gmC='git merge --no-commit'
alias gmF='git merge --no-ff'
alias gma='git merge --abort'
alias gmt='git mergetool'
# Push (p)
alias gp='git push'
alias gpf='git push --force'
alias gpa='git push --all'
alias gpA='git push --all && git push --tags'
alias gpt='git push --tags'
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"'
# Rebase (r)
alias gr='git rebase'
alias gra='git rebase --abort'
alias grr='git rebase --continue'
alias gri='git rebase --interactive'
alias grs='git rebase --skip'
# Remote (R)
alias gR='git remote'
alias gRl='git remote --verbose'
alias gRa='git remote add'
alias gRx='git remote rm'
alias gRm='git remote rename'
alias gRu='git remote update'
alias gRp='git remote prune'
alias gRs='git remote show'
alias gRb='git-hub-browse'
# Stash (s)
alias gs='git stash'
alias gsa='git stash apply'
alias gsx='git stash drop'
alias gsX='git-stash-clear-interactive'
alias gsl='git stash list'
alias gsL='git-stash-dropped'
alias gsd='git stash show --patch --stat'
alias gsp='git stash pop'
alias gsr='git-stash-recover'
alias gss='git stash save --include-untracked'
alias gsS='git stash save --patch --no-keep-index'
alias gsw='git stash save --include-untracked --keep-index'
# Submodule (S)
alias gS='git submodule'
alias gSa='git submodule add'
alias gSf='git submodule foreach'
alias gSi='git submodule init'
alias gSI='git submodule update --init --recursive'
alias gSl='git submodule status'
alias gSm='git-submodule-move'
alias gSs='git submodule sync'
alias gSu='git submodule foreach git pull origin master'
alias gSx='git-submodule-remove'
# Tag (t)
alias gts='git tag -s'
alias gtv='git verify-tag'
# Working Copy (w)
alias gws='git status --short'
alias gwS='git status'
alias gwd='git diff --no-ext-diff'
alias gwD='git diff --no-ext-diff --word-diff'
alias gwr='git reset --soft'
alias gwR='git reset --hard'
alias gwc='git clean -n'
alias gwC='git clean -df'
alias gwx='git rm -r'
alias gwX='git rm -rf'
# Misc
alias g..='cd $(git-root || print .)'

View File

@ -1,9 +1,181 @@
#
# git aliases and functions
# Git aliases.
#
if (( ! ${+commands[git]} )); then
return 1
fi
#
# Settings
#
source "${0:h}/alias.zsh"
# Log
_git_log_medium_format='%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B'
_git_log_oneline_format='%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n'
_git_log_brief_format='%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n'
#
# Aliases
#
# Git
alias g='git'
# Branch (b)
alias gb='git branch'
alias gbc='git checkout -b'
alias gbl='git branch -v'
alias gbL='git branch -av'
alias gbx='git branch -d'
alias gbX='git branch -D'
alias gbm='git branch -m'
alias gbM='git branch -M'
alias gbs='git show-branch'
alias gbS='git show-branch -a'
# Commit (c)
alias gc='git commit --verbose'
alias gca='git commit --verbose --all'
alias gcm='git commit --message'
alias gco='git checkout'
alias gcO='git checkout --patch'
alias gcf='git commit --amend --reuse-message HEAD'
alias gcF='git commit --verbose --amend'
alias gcp='git cherry-pick --ff'
alias gcP='git cherry-pick --no-commit'
alias gcr='git revert'
alias gcR='git reset "HEAD^"'
alias gcs='git show'
alias gcl='git-commit-lost'
alias gcS='git commit -S'
alias gpS='git show --pretty=short --show-signature'
# Conflict (C)
alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"'
alias gCa='git add $(gCl)'
alias gCe='git mergetool $(gCl)'
alias gCo='git checkout --ours --'
alias gCO='gCo $(gCl)'
alias gCt='git checkout --theirs --'
alias gCT='gCt $(gCl)'
# Data (d)
alias gd='git ls-files'
alias gdc='git ls-files --cached'
alias gdx='git ls-files --deleted'
alias gdm='git ls-files --modified'
alias gdu='git ls-files --other --exclude-standard'
alias gdk='git ls-files --killed'
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'
# Fetch (f)
alias gf='git fetch'
alias gfc='git clone'
alias gfm='git pull'
alias gfr='git pull --rebase'
alias gfu='git remote update -p; git merge --ff-only @\{u\}'
# Grep (g)
alias gg='git grep'
alias ggi='git grep --ignore-case'
alias ggl='git grep --files-with-matches'
alias ggL='git grep --files-without-matches'
alias ggv='git grep --invert-match'
alias ggw='git grep --word-regexp'
# Index (i)
alias gia='git add'
alias giA='git add --patch'
alias giu='git add --update'
alias gid='git diff --no-ext-diff --cached'
alias giD='git diff --no-ext-diff --cached --word-diff'
alias gir='git reset'
alias giR='git reset --patch'
alias gix='git rm -r --cached'
alias giX='git rm -rf --cached'
# Log (l)
alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"'
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"'
alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"'
alias glc='git shortlog --summary --numbered'
alias glS='git log --show-signature'
# Merge (m)
alias gm='git merge'
alias gmC='git merge --no-commit'
alias gmF='git merge --no-ff'
alias gma='git merge --abort'
alias gmt='git mergetool'
# Push (p)
alias gp='git push'
alias gpf='git push --force'
alias gpa='git push --all'
alias gpA='git push --all && git push --tags'
alias gpt='git push --tags'
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"'
# Rebase (r)
alias gr='git rebase'
alias gra='git rebase --abort'
alias grr='git rebase --continue'
alias gri='git rebase --interactive'
alias grs='git rebase --skip'
# Remote (R)
alias gR='git remote'
alias gRl='git remote --verbose'
alias gRa='git remote add'
alias gRx='git remote rm'
alias gRm='git remote rename'
alias gRu='git remote update'
alias gRp='git remote prune'
alias gRs='git remote show'
alias gRb='git-hub-browse'
# Stash (s)
alias gs='git stash'
alias gsa='git stash apply'
alias gsx='git stash drop'
alias gsX='git-stash-clear-interactive'
alias gsl='git stash list'
alias gsL='git-stash-dropped'
alias gsd='git stash show --patch --stat'
alias gsp='git stash pop'
alias gsr='git-stash-recover'
alias gss='git stash save --include-untracked'
alias gsS='git stash save --patch --no-keep-index'
alias gsw='git stash save --include-untracked --keep-index'
# Submodule (S)
alias gS='git submodule'
alias gSa='git submodule add'
alias gSf='git submodule foreach'
alias gSi='git submodule init'
alias gSI='git submodule update --init --recursive'
alias gSl='git submodule status'
alias gSm='git-submodule-move'
alias gSs='git submodule sync'
alias gSu='git submodule foreach git pull origin master'
alias gSx='git-submodule-remove'
# Tag (t)
alias gts='git tag -s'
alias gtv='git verify-tag'
# Working Copy (w)
alias gws='git status --short'
alias gwS='git status'
alias gwd='git diff --no-ext-diff'
alias gwD='git diff --no-ext-diff --word-diff'
alias gwr='git reset --soft'
alias gwR='git reset --hard'
alias gwc='git clean -n'
alias gwC='git clean -df'
alias gwx='git rm -r'
alias gwX='git rm -rf'
# Misc
alias g..='cd $(git-root || print .)'

View File

@ -1,92 +0,0 @@
#
# Pacman aliases
#
# ${zpacman_frontend} is provided by either .zimrc or (if not set) init.zsh
# The zpacman_frontend is _only_ used for package installs.
#
# General
#
alias pac=${zpacman_frontend}
#
# Build
#
# build package in current directory, cleanup, and install
alias pacb='makepkg -sci'
#
# Install
#
#NOTE: Installing/upgrading individual packages is NOT supported. Sync and upgrade ALL on install.
# install, sync, and upgrade packages
alias paci='sudo ${zpacman_frontend} -Syu'
# install, sync, and upgrade packages (forcibly refresh package lists)
alias pacu='sudo ${zpacman_frontend} -Syyu'
# install packages by filename
alias pacU='sudo ${zpacman_frontend} -U'
# install all packages in current directory
alias pacd='sudo ${zpacman_frontend} -U *.pkg.tar.xz'
#
# Remove
#
# remove package and unneeded dependencies
alias pacr='sudo pacman -R'
# remove package, unneeded dependencies, and configuration files
alias pacrm='sudo pacman -Rns'
#
# Query
#
# query package information from the remote repository
alias pacq='pacman -Si'
# query package information from the local repository
alias pacQ='pacman -Qi'
#
# Search
#
# search for package in the remote repository
alias pacs='pacman -Ss'
# search for the package in the local repository
alias pacS='pacman -Qs'
#
# Orphans
#
# list orphan packages
alias pacol='pacman -Qdt'
# remove orphan packages
alias pacor='sudo pacman -Rns $(pacman -Qtdq)'
#
# Ownership
#
# list all files that belong to a package
alias pacown='pacman -Ql'
# show package(s) owning the specified file
alias pacblame='pacman -Qo'

View File

@ -1,5 +1,12 @@
#
# Pacman aliases and functions
# Pacman aliases
#
# ${zpacman_frontend} is provided by either .zimrc or (if not set) init.zsh
# The zpacman_frontend is _only_ used for package installs.
#
# Setup
#
# ensure pacman is available
@ -26,6 +33,96 @@ elif (( ! ${+commands[${zpacman_frontend}]} )); then
zpacman_frontend='pacman'
fi
#
# General
#
alias pac=${zpacman_frontend}
#
# Build
#
# build package in current directory, cleanup, and install
alias pacb='makepkg -sci'
#
# Install
#
#NOTE: Installing/upgrading individual packages is NOT supported. Sync and upgrade ALL on install.
# install, sync, and upgrade packages
alias paci='sudo ${zpacman_frontend} -Syu'
# install, sync, and upgrade packages (forcibly refresh package lists)
alias pacu='sudo ${zpacman_frontend} -Syyu'
# install packages by filename
alias pacU='sudo ${zpacman_frontend} -U'
# install all packages in current directory
alias pacd='sudo ${zpacman_frontend} -U *.pkg.tar.xz'
#
# Remove
#
# remove package and unneeded dependencies
alias pacr='sudo pacman -R'
# remove package, unneeded dependencies, and configuration files
alias pacrm='sudo pacman -Rns'
#
# Query
#
# query package information from the remote repository
alias pacq='pacman -Si'
# query package information from the local repository
alias pacQ='pacman -Qi'
#
# Search
#
# search for package in the remote repository
alias pacs='pacman -Ss'
# search for the package in the local repository
alias pacS='pacman -Qs'
#
# Orphans
#
# list orphan packages
alias pacol='pacman -Qdt'
# remove orphan packages
alias pacor='sudo pacman -Rns $(pacman -Qtdq)'
#
# Ownership
#
# list all files that belong to a package
alias pacown='pacman -Ql'
# show package(s) owning the specified file
alias pacblame='pacman -Qo'
#
# Helpers
#
# source helper functions/aliases
for helper ( ${zpacman_helper[@]} ); do
if [[ -s ${0:h}/helper_${helper}.zsh ]]; then
@ -35,5 +132,3 @@ for helper ( ${zpacman_helper[@]} ); do
fi
done
# source pacman aliases
source ${0:h}/alias.zsh

View File

@ -2,7 +2,7 @@
# enables fish-shell like syntax highlighting
#
source "${0:h}/external/zsh-syntax-highlighting.zsh" || return 1
# highlighters
ZSH_HIGHLIGHT_HIGHLIGHTERS=(${zhighlighters[@]})
source "${0:h}/external/zsh-syntax-highlighting.zsh" || return 1

View File

@ -28,6 +28,14 @@ local zcompare() {
# Next, zcompile .zshrc if needed
zcompare ${ZDOTDIR:-${HOME}}/.zshrc
# Now, zcomplie some light module init scripts
zcompare ${ZDOTDIR:-${HOME}}/modules/git/init.zsh
zcompare ${ZDOTDIR:-${HOME}}/modules/utility/init.zsh
zcompare ${ZDOTDIR:-${HOME}}/modules/pacman/init.zsh
zcompare ${ZDOTDIR:-${HOME}}/modules/spectrum/init.zsh
zcompare ${ZDOTDIR:-${HOME}}/modules/completion/init.zsh
# Then, we should zcomplie the 'heavy' modules where possible.
# This includes syntax-highlighting and completion.
# Other modules may be added to this list at a later date.