# -*- mode: sh; -*-
source $ZPLUG_HOME/init.zsh
zplug "zsh-users/zsh-completions"
zplug "Tarrasch/zsh-autoenv", as:plugin
zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install"
zplug "caarlos0/zsh-open-pr", as:plugin
if [[ -n $commands[nix-env] ]]
then
zplug "spwhitt/nix-zsh-completions", as:plugin
fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions)
fi
zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]"
zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", nice:10
zplug "hlissner/zsh-autopair", nice:10
HISTSIZE=3000
SAVEHIST=10000
HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history
WORDCHARS=${${WORDCHARS//[-.]}//[\/]}
if [[ ${path[(I)$HOME/bin ]} ]]
then
path+=($HOME/bin)
fi
if [[ ${path[(I)$HOME/.local/bin ]} ]]
then
path+=($HOME/.local/bin)
fi
export EDITOR=emacsclient
alias ec=emacsclient
alias open-project=projectile
_emacs_function () {
emacsclient -e "($1 \"$2\")" > /dev/null
}
projectile () {
_emacs_function projectile-switch-project-by-name ${1:-$PWD}
}
yarn () {
PREFIX=$HOME/.local command yarn "$@"
}
ls='\ls'
gnu_ls_options="-v --group-directories-first --color=auto"
gnu_ls_isodate="--time-style=long-iso"
bsd_ls_options="-p"
bsd_ls_isodate="-D '%F %k:%M'"
case $OSTYPE in
darwin*)
if [[ -n $commands[gls] ]]
then
ls='\gls'
ls_options=$gnu_ls_options
ls_isodate=$gnu_ls_isodate
else
ls_options=$bsd_ls_options
ls_isodate=$bsd_ls_isodate
fi
;;
freebsd*)
ls_options=$bsd_ls_options
ls_isodate=$bsd_ls_isodate
;;
linux-gnu)
ls_options=$gnu_ls_options
ls_isodate=$gnu_ls_isodate
;;
esac
alias l="${ls} ${ls_options} -Bp"
alias l1="${ls} ${ls_options} -1"
alias ls="${ls} ${ls_options} -hF"
alias la="${ls} ${ls_options} -hA"
alias ll="${ls} ${ls_options} ${ls_isodate} -hl"
alias lal="ll -A"
alias lla="lal"
alias llr="ll -t"
zmodload zsh/terminfo
bindkey '\e[3~' delete-char
bindkey '\C-hd' describe-key-briefly
backward-argument () {
local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
zle backward-word
}
forward-argument () {
local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
zle forward-word
}
kill-argument () {
local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
zle backward-argument
zle kill-word
}
zle -N backward-argument
zle -N forward-argument
zle -N kill-argument
bindkey '\e^b' backward-argument
bindkey '\e^f' forward-argument
bindkey '\e^k' kill-argument
ds () {
du -hd1 $1 | sort -h
}
zle -C hist-complete complete-word _generic
zstyle ':completion:hist-complete:*' completer _history
bindkey '\e ' hist-complete
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
zstyle ':completion:*' completer _expand _complete _match
if [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]]
then
eval $(ssh-agent)
fi
if zplug check Tarrasch/zsh-autoenv
then
AUTOENV_FILE_ENTER=.envrc
AUTOENV_HANDLE_LEAVE=1
AUTOENV_LOOK_UPWARDS=1
fi
# Then, source plugins and add commands to $PATH
zplug load
# General configuration
setopt auto_cd # Change directories without `cd`
if zplug check zsh-users/zsh-completions
then
autoload -U compinit && compinit
fi
if [[ -n $commands[hub] ]]
then
compdef _hub hub
alias git=hub
alias gh=hub
fi
if [[ -n $commands[lunchy] ]]
then
LUNCHY_DIR=$(dirname $(gem which lunchy))/../extras
if [ -f $LUNCHY_DIR/lunchy-completion.zsh ]; then
. $LUNCHY_DIR/lunchy-completion.zsh
fi
fi
if [[ $TERM == "dumb" ]]
then
PROMPT="> "
else
unset RPROMPT
# show username@host if logged in through SSH
[[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f'
# show username@host if root, with username in white
[[ $UID -eq 0 ]] && prompt_pure_username=' %F{white}%n%f%F{242}@%m%f'
setopt prompt_subst
setopt prompt_cr
PROMPT='%F{blue}%~%f${prompt_pure_username}
%(?.%F{magenta}.%F{red})>%f '
fi
if zplug check clvv/fasd
then
if [[ -n $commands[fasd] ]]
then
_FASD_DATA="$HOME/.cache/zsh/fasd-data"
source =fasd
fasd_cache="$HOME/.fasd-init-zsh"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache
else
echo "no fasd"
fi
fi
unsetopt flow_control # Let me use ^S and ^Q
tag-zsh/config/zsh/zshrc (view raw)