145 lines
3.5 KiB
Bash
145 lines
3.5 KiB
Bash
# Path to your oh-my-zsh configuration.
|
|
ZSH=$HOME/.oh-my-zsh
|
|
export ZSH_DISABLE_COMPFIX=true
|
|
|
|
# Update config once every 24 hours
|
|
cd $HOME/.zcustom
|
|
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
|
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
|
# Example format: plugins=(rails git textmate ruby lighthouse)
|
|
|
|
case "`uname`" in
|
|
Linux)
|
|
STATARGS="-c %Z"
|
|
alias df='df -x squashfs -x tmpfs -x devtmpfs'
|
|
alias mount='mount -t ext3,ext4,cifs,nfs,nfs4,zfs,vfat,btrfs'
|
|
alias open=xdg-open
|
|
plugins=(asdf battery golang zsh-syntax-highlighting)
|
|
;;
|
|
Darwin)
|
|
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|
|
STATARGS="-f %m"
|
|
plugins=(asdf battery brew golang lein macos zsh-syntax-highlighting)
|
|
;;
|
|
OpenBSD)
|
|
STATARGS="-f %m"
|
|
plugins=(battery zsh-syntax-highlighting)
|
|
;;
|
|
FreeBSD)
|
|
STATARGS="-f %m"
|
|
plugins=(battery zsh-syntax-highlighting)
|
|
;;
|
|
*)
|
|
echo "Error! Unknown system `uname`"
|
|
exit 1
|
|
;;
|
|
esac
|
|
if [ -f .lastcheck ]; then
|
|
# if it hasn't been touched in the last week
|
|
NOW=`date +%s`
|
|
LAST=`stat $STATARGS .lastcheck`
|
|
if [ $(($NOW - $LAST)) -gt 604800 ]; then
|
|
echo "Updating config"
|
|
git pull
|
|
touch .lastcheck
|
|
fi
|
|
else
|
|
# Doesn't exist
|
|
touch .lastcheck
|
|
echo "Updating config"
|
|
git pull
|
|
fi
|
|
cd
|
|
|
|
# Aliases
|
|
# Disable correction.
|
|
alias ack='nocorrect ack'
|
|
alias cd='nocorrect cd'
|
|
alias cp='nocorrect cp'
|
|
alias ebuild='nocorrect ebuild'
|
|
alias gist='nocorrect gist'
|
|
alias grep='nocorrect grep'
|
|
alias heroku='nocorrect heroku'
|
|
alias ln='nocorrect ln'
|
|
alias man='nocorrect man'
|
|
alias mkdir='nocorrect mkdir'
|
|
alias mv='nocorrect mv'
|
|
alias rm='nocorrect rm'
|
|
|
|
# Disable globbing.
|
|
alias fc='noglob fc'
|
|
alias find='noglob find'
|
|
alias ftp='noglob ftp'
|
|
alias history='noglob history'
|
|
alias locate='noglob locate'
|
|
alias rake='noglob rake'
|
|
alias rsync='noglob rsync'
|
|
alias scp='noglob scp'
|
|
alias sftp='noglob sftp'
|
|
|
|
# Define general aliases.
|
|
alias _='sudo'
|
|
alias cp="${aliases[cp]:-cp} -i"
|
|
alias ln="${aliases[ln]:-ln} -i"
|
|
alias mkdir="${aliases[mkdir]:-mkdir} -p"
|
|
alias mv="${aliases[mv]:-mv} -i"
|
|
alias rm="${aliases[rm]:-rm} -i"
|
|
alias l='ls -l'
|
|
alias cls=clear
|
|
|
|
DISABLE_UPDATE_PROMPT="true"
|
|
|
|
# Uncomment following line if you want to disable marking untracked files under
|
|
# VCS as dirty. This makes repository status check for large repositories much,
|
|
# much faster.
|
|
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
# Customize to your needs...
|
|
|
|
unsetopt AUTO_PUSHD
|
|
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/X11/bin:$HOME/bin:."
|
|
|
|
#bindkey -e
|
|
function follow() {
|
|
if [ $# -eq 0 ]; then
|
|
echo "Usage: follow <filename>\nChange to the directory holding <filename>\n"
|
|
else
|
|
pushd `filepath $1`
|
|
fi
|
|
}
|
|
|
|
# MPU -- Combination of mkdir -p and pushd
|
|
function mpu() {
|
|
if [ $# -lt 1 ]; then
|
|
echo "Usage: `basename $0` <dir> -- Makes dir (and any ancestor directories) if necessary, and then pushes to it"
|
|
else
|
|
mkdir -p $1
|
|
pushd $1
|
|
fi
|
|
}
|
|
|
|
# Source per-instance customizations if they exist
|
|
if [ -e $HOME/.zcustom/zshrc ]; then
|
|
source $HOME/.zcustom/zshrc
|
|
fi
|
|
|
|
# Remove duplicate entries in the PATH
|
|
typeset -U path
|
|
|
|
if [ -e $HOME/.asdf/asdf.sh ]; then
|
|
source $HOME/.asdf/asdf.sh
|
|
fi
|
|
|
|
|
|
# >>> juliaup initialize >>>
|
|
|
|
# !! Contents within this block are managed by juliaup !!
|
|
|
|
path=('${HOME}/.juliaup/bin' $path)
|
|
export PATH
|
|
|
|
# <<< juliaup initialize <<<
|
|
|