Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
147 lines (125 sloc) 3.94 KB
export PATH=$HOME/.local/bin:$HOME/.cabal/bin:/opt/ghc/bin:$HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH
export EDITOR=vim
# Entware-ng
ENTWARE_PROFILE="/opt/etc/profile"
[[ -f "$ENTWARE_PROFILE" ]] && source "$ENTWARE_PROFILE"
# Rust
CARGO="$HOME/.cargo/bin"
[[ -d "$CARGO" ]] && export PATH=$CARGO:$PATH
# Phab
ARC="$HOME/src/github.com/phacility/arcanist/bin"
[[ -d "$ARC" ]] && export PATH=$ARC:$PATH
# Keep dotfiles repo up-to-date
DOTFILES=$(find ~/dotfiles/.touch -mtime -7 2>/dev/null)
if [ -z $DOTFILES ]; then
pushd ~/dotfiles >/dev/null
echo "Updating dotfiles repo"
git pull origin master
[[ $? -eq 0 ]] && clear
echo "Updating dotfiles submodules"
git submodule update -i
[[ $? -eq 0 ]] && clear
touch .touch
popd >/dev/null
fi
unset DOTFILES
# Keep git-completion.zsh up-to-date within 60 days old
GIT_COMPLETION=$(find ~/.git-completion.zsh -mtime -60 2>/dev/null)
if [ -z $GIT_COMPLETION ]; then
echo "Updating git-completion"
curl "https://raw.github.com/zsh-users/zsh/master/Completion/Unix/Command/_git" > ~/.git-completion.zsh 2>/dev/null
[[ $? -eq 0 ]] && clear
fi
unset GIT_COMPLETION
[[ -f ~/.git-completion.zsh ]] && source ~/.git-completion.zsh
[[ -f ~/dotfiles/modules/git-flow-completion/git-flow-completion.zsh ]] && source ~/dotfiles/modules/git-flow-completion/git-flow-completion.zsh
prepath() {
if [ ! -d "$1" ]; then
echo 1>&2 "$1 is not a directory."
return 1
fi
dir=$(cd $1; /bin/pwd)
if echo ":$PATH:" | grep -q ":$dir:"; then
:
else
PATH="$dir:$PATH"
fi
}
preghc() {
local binpath
local gnusort
type gsort >/dev/null 2>&1 && gnusort=gsort || gnusort=sort
for i in `ls /usr/local/ghc/ghc-$1*/bin/ghc | $gnusort -V`; do
if ! [ -x $i ]; then
echo 1>&2 "Not found or not executable: $i"
return 1
fi
local dir=$(dirname $i)
echo $dir | grep HEAD >/dev/null 2>&1
if [ $? -eq 0 ] && [ -z "$1" ]; then
continue
fi
binpath="$dir"
done
els=""
for el in $(echo "$PATH" | sed -e 's/:/ /g'); do
case "$el" in
*ghc*) : ;;
*) els="$els $el";;
esac
done
PATH=$(echo $els | sed -e 's/ /:/g' | sed -e 's/^://')
echo 1>&2 $(dirname $binpath)
prepath $binpath
}
# aliases
alias dstat-full='dstat -Tclmdrn'
alias dstat-mem='dstat -Tclm'
alias dstat-cpu='dstat -Tclr'
alias dstat-net='dstat -Tclnd'
alias dstat-disk='dstat -Tcldr'
alias knife='nocorrect knife'
alias cabal='nocorrect ~/.local/bin/cabal'
source $HOME/.zshrc.antigen
case "${OSTYPE}" in
darwin*)
[ -f $HOME/.zshrc.mac ] && . $HOME/.zshrc.mac
;;
linux*)
[ -f $HOME/.zshrc.linux ] && . $HOME/.zshrc.linux
;;
esac
function exists { which $1 &> /dev/null }
# zsh history search using peco
if exists peco; then
function peco_select_history() {
local tac
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
BUFFER=$(\history -n 1 | eval $tac | peco --query "$LBUFFER")
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
zle -N peco_select_history
bindkey '^R' peco_select_history
if exists ghq; then
function peco_ghq_look() {
local selected_dir=$(ghq list -p | peco --query "$LBUFFER")
if [ -n "$selected_dir" ]; then
BUFFER="cd ${selected_dir}"
zle accept-line
fi
zle clear-screen
}
zle -N peco_ghq_look
bindkey '^G^L' peco_ghq_look
fi
fi
export GOPATH=$HOME/.go
NPM_PACKAGES="${HOME}/.npm-packages"
PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath` command
unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
export GPG_TTY=$(tty)
# added by travis gem
[ -f $HOME/.travis/travis.sh ] && source $HOME/.travis/travis.sh