summary refs log tree commit diff stats
path: root/tag-zsh
diff options
context:
space:
mode:
authorAlan Pearce2016-06-26 17:29:22 +0200
committerAlan Pearce2016-06-26 17:29:22 +0200
commit61a885bece9549f994731b9017c00491b1cb6499 (patch)
treef84f2c24a6c078aaafc3338bcdca91cdf8f525ff /tag-zsh
parent32c46b315483ec2f58f14acd5cc3d9145c65c65c (diff)
parent097663cb10d0e8c244063af28295cff6d686f1bb (diff)
downloadnixfiles-61a885bece9549f994731b9017c00491b1cb6499.tar.lz
nixfiles-61a885bece9549f994731b9017c00491b1cb6499.tar.zst
nixfiles-61a885bece9549f994731b9017c00491b1cb6499.zip
Re-make zsh configuration
Start using zplug with the bare minimum of extra configuration
Diffstat (limited to 'tag-zsh')
-rw-r--r--tag-zsh/config/zsh/completion/_tmux_pane_words10
-rw-r--r--tag-zsh/config/zsh/fasd.zsh84
-rwxr-xr-xtag-zsh/config/zsh/freebsd.zsh8
-rw-r--r--tag-zsh/config/zsh/functions/pure/prompt_pure_setup121
-rw-r--r--tag-zsh/config/zsh/functions/runit/_sv7
-rw-r--r--tag-zsh/config/zsh/functions/runit/getservicedir2
-rw-r--r--tag-zsh/config/zsh/functions/runit/linksv16
-rw-r--r--tag-zsh/config/zsh/functions/runit/renamesv36
-rw-r--r--tag-zsh/config/zsh/osx.zsh3
-rw-r--r--tag-zsh/config/zsh/server.zsh5
-rwxr-xr-xtag-zsh/config/zsh/zlogin0
-rwxr-xr-xtag-zsh/config/zsh/zlogout0
-rw-r--r--[-rwxr-xr-x]tag-zsh/config/zsh/zshenv61
-rw-r--r--[-rwxr-xr-x]tag-zsh/config/zsh/zshrc374
-rw-r--r--tag-zsh/fasdrc8
15 files changed, 52 insertions, 683 deletions
diff --git a/tag-zsh/config/zsh/completion/_tmux_pane_words b/tag-zsh/config/zsh/completion/_tmux_pane_words
deleted file mode 100644
index 6ff9ce18..00000000
--- a/tag-zsh/config/zsh/completion/_tmux_pane_words
+++ /dev/null
@@ -1,10 +0,0 @@
-local expl
-local -a w
-
-if [[ -z "$TMUX_PANE" ]]; then
-	_message "not running inside tmux!"
-	return 1
-fi
-
-w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} )
-_wanted values expl 'words from current tmux pane' compadd -a w
diff --git a/tag-zsh/config/zsh/fasd.zsh b/tag-zsh/config/zsh/fasd.zsh
deleted file mode 100644
index 7143ac7d..00000000
--- a/tag-zsh/config/zsh/fasd.zsh
+++ /dev/null
@@ -1,84 +0,0 @@
-alias a='fasd -a'
-alias s='fasd -si'
-alias sd='fasd -sid'
-alias d='fasd -d'
-alias f='fasd -f'
-# function to execute built-in cd
-fasd_cd() {
-  if [ $# -le 1 ]; then
-    fasd "$@"
-  else
-    local _fasd_ret="$(fasd -e 'printf %s' "$@")"
-    [ -z "$_fasd_ret" ] && return
-    [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret"
-  fi
-}
-alias z='fasd_cd -d'
-alias zz='fasd_cd -d -i'
-
-# add zsh hook
-_fasd_preexec() {
-  { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/dev/null" 2>&1
-}
-autoload -Uz add-zsh-hook
-add-zsh-hook preexec _fasd_preexec
-
-# zsh command mode completion
-_fasd_zsh_cmd_complete() {
-  local compl
-  read -c compl
-  (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded
-  reply=(${(f)"$(fasd --complete "$compl")"})
-}
-
-# enbale command mode completion
-compctl -U -K _fasd_zsh_cmd_complete -V fasd -x 'C[-1,-*e],s[-]n[1,e]' -c - \
-  'c[-1,-A][-1,-D]' -f -- fasd fasd_cd
-
-(( $+functions[compdef] )) && {
-  # zsh word mode completion
-  _fasd_zsh_word_complete() {
-    [ "$2" ] && local _fasd_cur="$2"
-    [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}"
-    local fnd="${_fasd_cur//,/ }"
-    local typ=${1:-e}
-    fasd --query $typ "$fnd" 2>> "/dev/null" | \
-      sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do
-        compadd -U -V fasd "$line"
-      done
-    compstate[insert]=menu # no expand
-  }
-  _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; }
-  _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; }
-  _fasd_zsh_word_complete_trigger() {
-    local _fasd_cur="${words[CURRENT]}"
-    eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur)
-  }
-  # define zle widgets
-  zle -C fasd-complete complete-word _generic
-  zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete
-  zstyle ':completion:fasd-complete:*' menu-select
-
-  zle -C fasd-complete-f complete-word _generic
-  zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f
-  zstyle ':completion:fasd-complete-f:*' menu-select
-
-  zle -C fasd-complete-d complete-word _generic
-  zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d
-  zstyle ':completion:fasd-complete-d:*' menu-select
-}
-
-(( $+functions[compdef] )) && {
-  # enable word mode completion
-  orig_comp="$(zstyle -L ':completion:\*' completer 2>> "/dev/null")"
-  if [ "$orig_comp" ]; then
-    case $orig_comp in
-      *_fasd_zsh_word_complete_trigger*);;
-      *) eval "$orig_comp _fasd_zsh_word_complete_trigger";;
-    esac
-  else
-    zstyle ':completion:*' completer _complete _fasd_zsh_word_complete_trigger
-  fi
-  unset orig_comp
-}
-
diff --git a/tag-zsh/config/zsh/freebsd.zsh b/tag-zsh/config/zsh/freebsd.zsh
deleted file mode 100755
index 6ca0f8d6..00000000
--- a/tag-zsh/config/zsh/freebsd.zsh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env zsh
-function update-check () {
-	sudo portsnap update
-	sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }'
-	sudo pkg audit
-	pkg updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' )
-}
-alias iotop="top -m io -o total"
diff --git a/tag-zsh/config/zsh/functions/pure/prompt_pure_setup b/tag-zsh/config/zsh/functions/pure/prompt_pure_setup
deleted file mode 100644
index 5b92ee5c..00000000
--- a/tag-zsh/config/zsh/functions/pure/prompt_pure_setup
+++ /dev/null
@@ -1,121 +0,0 @@
-# Pure
-# by Sindre Sorhus
-# https://github.com/sindresorhus/pure
-# MIT License
-
-# For my own and others sanity
-# git:
-# %b => current branch
-# %a => current action (rebase/merge)
-# prompt:
-# %F => color dict
-# %f => reset color
-# %~ => current path
-# %* => time
-# %n => username
-# %m => shortname host
-# %(?..) => prompt conditional - %(condition.true.false)
-
-
-# turns seconds into human readable time
-# 165392 => 1d 21h 56m 32s
-prompt_pure_human_time() {
-	local tmp=$1
-	local days=$(( tmp / 60 / 60 / 24 ))
-	local hours=$(( tmp / 60 / 60 % 24 ))
-	local minutes=$(( tmp / 60 % 60 ))
-	local seconds=$(( tmp % 60 ))
-	(( $days > 0 )) && echo -n "${days}d "
-	(( $hours > 0 )) && echo -n "${hours}h "
-	(( $minutes > 0 )) && echo -n "${minutes}m "
-	echo "${seconds}s"
-}
-
-# fastest possible way to check if repo is dirty
-prompt_pure_git_dirty() {
-	# check if we're in a git repo
-	command git rev-parse --is-inside-work-tree &>/dev/null || return
-	# check if it's dirty
-	command git diff --quiet --ignore-submodules HEAD &>/dev/null
-
-	(($? == 1)) && echo '*'
-}
-
-# displays the exec time of the last command if set threshold was exceeded
-prompt_pure_cmd_exec_time() {
-	local stop=$EPOCHSECONDS
-	local start=${cmd_timestamp:-$stop}
-	integer elapsed=$stop-$start
-	(($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed
-}
-
-prompt_pure_preexec() {
-	cmd_timestamp=$EPOCHSECONDS
-
-	# shows the current dir and executed command in the title when a process is active
-	print -Pn "\e]0;"
-	echo -nE "$PWD:t: $2"
-	print -Pn "\a"
-}
-
-# string length ignoring ansi escapes
-prompt_pure_string_length() {
-	echo ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}}
-}
-
-prompt_pure_precmd() {
-	# shows the full path in the title
-	print -Pn '\e]0;%~\a'
-
-	# git info
-	vcs_info
-
-	local prompt_pure_preprompt="\n%F{blue}%~%F{242}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f"
-	print -P $prompt_pure_preprompt
-
-	# check async if there is anything to pull
-	(( ${PURE_GIT_PULL:-1} )) && {
-		# check if we're in a git repo
-		command git rev-parse --is-inside-work-tree &>/dev/null &&
-		# check check if there is anything to pull
-		command git fetch &>/dev/null &&
-		# check if there is an upstream configured for this branch
-		command git rev-parse --abbrev-ref @'{u}' &>/dev/null && {
-			local arrows=''
-			(( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows='⇣'
-			(( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+='⇡'
-			print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}${arrows}%f\e8"
-		}
-	} &!
-
-	# reset value since `preexec` isn't always triggered
-	unset cmd_timestamp
-}
-
-
-prompt_pure_setup() {
-	# prevent percentage showing up
-	# if output doesn't end with a newline
-	export PROMPT_EOL_MARK=''
-
-	prompt_opts=(cr subst percent)
-
-	zmodload zsh/datetime
-	autoload -Uz add-zsh-hook
-	autoload -Uz vcs_info
-
-	add-zsh-hook precmd prompt_pure_precmd
-	add-zsh-hook preexec prompt_pure_preexec
-
-	zstyle ':vcs_info:*' enable git
-	zstyle ':vcs_info:git*' formats ' %b'
-	zstyle ':vcs_info:git*' actionformats ' %b|%a'
-
-	# show username@host if logged in through SSH
-	[[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m '
-
-	# prompt turns red if the previous command didn't exit with 0
-	PROMPT='%(?.%F{magenta}.%F{red})❯%f '
-}
-
-prompt_pure_setup "$@"
diff --git a/tag-zsh/config/zsh/functions/runit/_sv b/tag-zsh/config/zsh/functions/runit/_sv
deleted file mode 100644
index bf98b3ea..00000000
--- a/tag-zsh/config/zsh/functions/runit/_sv
+++ /dev/null
@@ -1,7 +0,0 @@
-#compdef sv
-
-_arguments -A -S -s \
-	'-v[wait up to 7 seconds for the command to take effect. (up|down|term|once|cont|exit)]' \
-	'-w+[wait for %n seconds]: :_guard "[0-9]#" "numeric value"' \
-	'1:command:(status up down once pause cont hup alarm interrupt quit 1 2 term kill exit start stop restart shutdown force-stop force-reload force-restart force-shutdown check)' \
-	'*:installed service:_files -W ${SVDIR:-/service}'
diff --git a/tag-zsh/config/zsh/functions/runit/getservicedir b/tag-zsh/config/zsh/functions/runit/getservicedir
deleted file mode 100644
index 2e5d961c..00000000
--- a/tag-zsh/config/zsh/functions/runit/getservicedir
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env zsh
-print ${$(readlink ${SVDIR:-/service}/$1):h}
\ No newline at end of file
diff --git a/tag-zsh/config/zsh/functions/runit/linksv b/tag-zsh/config/zsh/functions/runit/linksv
deleted file mode 100644
index 7ee71094..00000000
--- a/tag-zsh/config/zsh/functions/runit/linksv
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env zsh
-
-if [[ -z $1 ]]; then
-	echo "No service specified"
-	return 64
-fi
-
-
-if [[ ! -x $1 ]]; then
-	echo "Service does not exist in current directory"
-	return 1
-fi
-
-mv $1{,.old}
-ln -s =sv $1
-chmod -h a-w $1
diff --git a/tag-zsh/config/zsh/functions/runit/renamesv b/tag-zsh/config/zsh/functions/runit/renamesv
deleted file mode 100644
index dba1098d..00000000
--- a/tag-zsh/config/zsh/functions/runit/renamesv
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env zsh
-local svdir=${SVDIR:-/service}
-if [[ -z $1 || -z $2 ]]; then
-	echo "Usage: $0 source target"
-	return 64
-fi
-
-if [[ ! -h $svdir/$1 ]]; then
-	echo $svdir/$1 does not exist
-	return 2
-fi
-
-if [[ -e $svdir/$2 ]]; then
-	echo $svdir/$2 already exists
-	return 3
-fi
-
-local servicedir=`getservicedir`
-
-if [[ ! ( -w $svdir && -w $servicedir ) ]]; then
-	echo $svdir or $servicedir is not writeable
-fi
-
-# The service doesn't have to be stopped as removing the link will do that
-# However, running the same service twice isn't a great idea, so wait here
-sv stop $1
-
-rm -f $svdir/$1 || return
-
-mv $servicedir/{$1,$2} || return
-
-ln -s {$servicedir,$svdir}/$2 || return
-
-sv start $2
-
-return
diff --git a/tag-zsh/config/zsh/osx.zsh b/tag-zsh/config/zsh/osx.zsh
deleted file mode 100644
index d99019ba..00000000
--- a/tag-zsh/config/zsh/osx.zsh
+++ /dev/null
@@ -1,3 +0,0 @@
-function netmount () {
-	osascript -e "try" -e "mount volume \"$1\"" -e "end try"
-}
diff --git a/tag-zsh/config/zsh/server.zsh b/tag-zsh/config/zsh/server.zsh
deleted file mode 100644
index f9274c71..00000000
--- a/tag-zsh/config/zsh/server.zsh
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- shell-script -*-
-
-zstyle ':completion:*' local server /tank/www/internal ''
-zstyle ':completion:*' local external /tank/www/external
-zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external
diff --git a/tag-zsh/config/zsh/zlogin b/tag-zsh/config/zsh/zlogin
deleted file mode 100755
index e69de29b..00000000
--- a/tag-zsh/config/zsh/zlogin
+++ /dev/null
diff --git a/tag-zsh/config/zsh/zlogout b/tag-zsh/config/zsh/zlogout
deleted file mode 100755
index e69de29b..00000000
--- a/tag-zsh/config/zsh/zlogout
+++ /dev/null
diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv
index 5d206c98..d5ef76a1 100755..100644
--- a/tag-zsh/config/zsh/zshenv
+++ b/tag-zsh/config/zsh/zshenv
@@ -1,65 +1,6 @@
-# -*- mode: sh; -*-
-export GOPATH="$HOME/projects/go"
-
-if [[ $defpath == "" ]]
-then
-	defpath=($path)
-	path=(
-		$defpath
-		~/bin
-		$GOPATH/bin
-	)
-fi
-
-export PATH
-
-myfuncs=( $ZDOTDIR/functions/*(/) )
-fpath=(
-	$myfuncs
-	$ZDOTDIR/completion/
-	$fpath
-)
-if [[ -d /usr/local/share/zsh-completions ]]
-then
-	fpath=(/usr/local/share/zsh-completions $fpath)
-fi
-
-if [[ -d /usr/local/share/zsh/site-functions ]]
-then
-	fpath=(/usr/local/share/zsh/site-functions $fpath)
-fi
-
-if [[ -d /usr/local/opt/pass/share/zsh/site-functions ]]
-then
-	fpath=($fpath /usr/local/opt/pass/share/zsh/site-functions)
-fi
-
-export FPATH
-
-case $OSTYPE in
-	*gnu*)
-		os=gnu
-		;;
-	freebsd*)
-		os=freebsd
-		;;
-	darwin*)
-		os=osx
-esac
-
-export os
-
 if [[ -f $ZDOTDIR/zshenv.local ]]
 then
 	. $ZDOTDIR/zshenv.local
 fi
 
-if [[ -f $ZDOTDIR/zshenv.private ]]
-then
-	. $ZDOTDIR/zshenv.private
-fi
-
-if [[ -s $commands[direnv] ]]
-then
-	eval "$(direnv hook zsh)"
-fi
+ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug}
\ No newline at end of file
diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc
index 73dad6df..237b94a0 100755..100644
--- a/tag-zsh/config/zsh/zshrc
+++ b/tag-zsh/config/zsh/zshrc
@@ -1,222 +1,24 @@
 # -*- mode: sh; -*-
-export PAGER="less"
-export EDITOR="emacsclient"
-export CLICOLOR=true
-export LESSGLOBALTAGS=global
+source ${ZPLUG_HOME:-~/projects/zplug}/init.zsh
 
-#
-# zsh variables
-#
-HISTFILE=~/.cache/zsh/history
-HISTSIZE=4000
-SAVEHIST=3000
+zplug "zsh-users/zsh-completions"
+zplug "mafredri/zsh-async"
+zplug "sindresorhus/pure", on:"mafredri/zsh-async"
+zplug "Tarrasch/zsh-autoenv", as:plugin
+zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install"
+zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}"
+zplug "tymm/zsh-directory-history", as:plugin
 
 WORDCHARS='*?_-[]~.&;!#$%^(){}<>'
 
-#If a command takes more than 5 seconds, give statistics
-REPORTTIME=5
-TIMEFMT="%U user %S system %P cpu %*Es total"
-
-#Check for user logins
-watch=notme
-WATCHFMT="%n has %a %l from %M at %t"
-
-hosts=(
-	server
-	prefect
-	alanpearce.co.uk
-	home.alanpearce.co.uk
-)
-
-users=(alan root toor)
-
-if [[ $os == "gnu" && -z $SSH_CLIENT ]]
-then
-	export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
-fi
-
-LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:'
-
-#Ignore suffixes in completion
-fignore=(
-    svbin
-)
-
-#
-# Modules
-#
-autoload -Uz compinit bashcompinit
-autoload -U colors complist zrecompile zmv zargs zed
-autoload -Uz vcs_info
-autoload insert-files
-zle -N insert-files
-zmodload -i zsh/complist
-colors
-compinit -u -d .cache/zsh/compdump
-bashcompinit
-
-zstyle :compinstall filename '~/.zshrc'
-
-autoload -Uz _tmux_pane_words
-zle -C tmux-pane-words-prefix   complete-word _generic
-zle -C tmux-pane-words-anywhere complete-word _generic
-zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words
-zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
-zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
-
-# Speed up completion by not going further than a full match
-zstyle ':completion:*' accept-exact '*(N)'
-
-zstyle ':completion:*:default' use-cache on
-zstyle ':completion:*:default' cache-path ~/.zsh/cache/compcache
-
-zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
-zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _match
-
-zstyle ':completion:*'              verbose    yes
-zstyle ':completion:*:messages'     format     '%d'
-zstyle ':completion:*:warnings'     format     'No   matches  for: %d'
-zstyle ':completion:*:descriptions' format     '%U%B%d%b%u'
-zstyle ':completion:*:corrections'  format     '%B%d (errors: %e)%b'
-zstyle ':completion:*'              group-name ''
-
-# Complete all user processes
-zstyle ':completion:*:processes' command 'ps -au$USER'
-# Add colour to process lists
-zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
-zstyle ':completion:*:*:kill:*'           menu        yes    select
-zstyle ':completion:*:kill:*'             force-list  always
-zstyle ':completion:*:*:killall:*'        menu        yes    select
-zstyle ':completion:*:killall:*'          force-list  always
-
-# Complete unreadable log filenames
-#zstyle ':completion::complete:(most|tail)::' fake-files '/var/log/*:current'
-
-# Group manpages by section
-zstyle ':completion:*' separate-sections true
-
-# Users
-#zstyle '*' users $users
-
-zstyle '*' hosts $hosts
-
-zstyle ':completion:*:functions' ignored-patterns '_*'
-zstyle ':completion:*:cd:*'	     ignore-parents parent pwd
-
-#This works, but isn't the same as ls
-#zstyle ':completion:*:default' list-colors ''
-zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
-
-zstyle ':vcs_info:*' enable git hg
-
-# Filename suffixes to ignore during completion (except after rm command)
-zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro'
-
-## Prompt
-if [[ $TERM != 'dumb' ]]
-then
-	autoload -U promptinit
-	promptinit
-	prompt pure
-	RPROMPT=
-fi
-
-# Options
-
-# Changing directories
-setopt auto_cd
-
-# Completion
-setopt auto_list # List multiple choices on first tab
-unsetopt list_ambiguous # List ambiguous choices rather than completing common prefixes
-unsetopt list_beep # Don't try to beep here
-setopt list_types # Indicate file types
-
-# Expansion and globbing
-setopt extended_glob # Use #~^ as part of filename patterns
-unsetopt nomatch
-
-# History
-unsetopt hist_beep
-setopt hist_expire_dups_first
-setopt hist_fcntl_lock # Use standard locking on histfile
-setopt hist_find_no_dups
-setopt hist_ignore_space
-setopt hist_reduce_blanks
-setopt hist_verify
-setopt share_history
-setopt inc_append_history
-
-# Input/Output
-unsetopt clobber
-unsetopt flow_control
-setopt path_dirs # Search PATH even with slashes
-setopt print_exit_value
-
-# Job Control
-setopt auto_continue
-unsetopt nohup
-setopt long_list_jobs
-unsetopt notify
-
-# Scripts and functions
-unsetopt multi_func_def
-setopt multios
-
-# Zle
-unsetopt beep
-
-############
-# Keybinds #
-############
-#General
-bindkey "[1~"   beginning-of-line
-bindkey "[4~"   end-of-line
-bindkey "[5~"   beginning-of-history
-bindkey "[6~"   end-of-history
-bindkey "[2~"   quoted-insert
-bindkey "[3~"   delete-char
-
-bindkey ''      backward-delete-char
-
-bindkey '^I'      expand-or-complete-prefix
-bindkey ''    reverse-menu-complete
-bindkey ''    up-line-or-search
-bindkey ''    down-line-or-search
-
-#urxvt
-bindkey '[3;5~' delete-word
-bindkey '' backward-word
-bindkey '' forward-word
-
-bindkey 'f'	  insert-files
-bindkey 'd'     describe-key-briefly
-
-bindkey '\'	  tmux-pane-words-prefix
-bindkey '|'	  tmux-pane-words-anywhere
-
-# Aliases before functions
-alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"'
-alias grep='grep --color=auto'
-alias df='df -h'
-alias du='du -h'
-alias md='mkdir -p'
-alias rd='rmdir'
-for ((i = 1; i <= 5; i++))
-do
-	alias $i="head -n$i"
-	alias -$i="tail -n$i"
-done
-alias .='source'
-
 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 $os in
-	osx)
+case $OSTYPE in
+	darwin*)
 		if [[ -n $commands[gls] ]]
 		then
 			ls='\gls'
@@ -227,11 +29,11 @@ case $os in
 			ls_isodate=$bsd_ls_isodate
 		fi
 		;;
-	freebsd)
+	freebsd*)
 		ls_options=$bsd_ls_options
 		ls_isodate=$bsd_ls_isodate
 		;;
-	gnu)
+	linux-gnu)
 		ls_options=$gnu_ls_options
 		ls_isodate=$gnu_ls_isodate
 		;;
@@ -244,130 +46,56 @@ alias ll="${ls} ${ls_options} ${ls_isodate} -hl"
 alias lal="ll -A"
 alias lla="lal"
 alias llr="ll -t"
-alias gpp='g++'
-alias lsr="${ls} -tld *(m-2)" # mtime < -2days
-alias sf="app/console"
 
-alias pping="prettyping.sh"
-if [[ -z $commands[gpg] && -s $commands[gpg2] ]]
+if zplug check Tarrasch/zsh-autoenv
 then
-	alias gpg=gpg2
+	AUTOENV_FILE_ENTER=.envrc
+	AUTOENV_HANDLE_LEAVE=0
+	AUTOENV_LOOK_UPWARDS=1
 fi
 
-alias trans="transmission-remote transmission.home"
-alias bitcoin="bitcoind"
-alias su="smart_sudo "
-alias E="SUDO_EDITOR=\"emacsclient -c -a emacs\" sudoedit"
-alias wprop='xprop |awk '\''
-    /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print}
-    /^WM_NAME/{sub(/.* =/, "title:"); print}
-    /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\'''
-
-alias et="emacsclient -t"
-
-alias -g ...='../..'
+# Then, source plugins and add commands to $PATH
+zplug load
 
-#Suffix aliases
-alias -s log=less
+# General configuration
+setopt auto_cd 					# Change directories without `cd`
 
-if [[ -e =hub ]]; then
-	alias git="hub"
-	if [[ -n $functions[_hub] ]];then
-		compdef _hub hub
-	fi
-	alias gh="hub"
+if zplug check zsh-users/zsh-completions
+then
+	autoload -U compinit && compinit
 fi
 
-# Functions
-
-magit () {
-	emacsclient -e "(magit-status \"$PWD\")" > /dev/null
-}
-
-dired () {
-	emacsclient -e "(dired \"${1:-$PWD}\")" > /dev/null
-}
-
-pid () {
-    local i
-    for i in /proc/<->/stat
-    [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t
-    return 0
-}
-
-_force_rehash() {
-    (( CURRENT == 1 )) && rehash
-    return 1        # Because we didn't really complete anything
-}
-
-portgrep() {
-    sudo lsof -i :$1 -nP | egrep '(LISTEN|UDP|COMMAND)'
-}
-
-ipgrep() {
-    sudo lsof -i @$1 -nP
-}
-
-smart_sudo () {
-    if [[ -n $1 ]]; then
-        \sudo $argv
-    else
-        #if no parameters were given, then assume we want a root shell
-        \sudo -i -u toor
-    fi
-}
-
-compdef _sudo smart_sudo
-
-smart_compile () {
-	local zcompargs
-	if [[ $1 = *zshrc* ]]; then
-		zcompargs="-R"
-	fi
-
-	if [[ $EUID -ne 0 || $1 != *alan* ]]; then
-		zrecompile -q -p $zcompargs $1
-	fi
-	if [[ -n $2 ]]; then
-		. $1
-	fi
-}
-
-emacs_change_focus () {
-	emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null
-}
-
-ec () {
-	local frameNeeded
-	frameNeeded=$(emacsclient -e '(> (if (daemonp) 2 1) (length (visible-frame-list)))')
-	if [[ $? -ne 0 ]]; then
-		print "Daemon not running"
-		return 1
-	fi
+if zplug check sindresorhus/pure
+then
+	PURE_GIT_PULL=0
+	autoload -Uz promptinit && promptinit
+	prompt pure &> /dev/null
+fi
 
-	if [[ $frameNeeded == 't' ]]; then
-		emacsclient -n -c "$@" && emacs_change_focus
-	else
-		emacs_change_focus
-		if [[ $# -gt 0 ]]; then
-			emacsclient -n "$@"
+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
 
-if [[ -n $commands[fasd] && -e ~/.config/zsh/fasd.zsh ]]
+if zplug check tymm/zsh-directory-history
 then
-	_FASD_DATA="$HOME/.cache/zsh/fasd-data"
-	source ~/.config/zsh/fasd.zsh
-else
-	echo "fasd not enabled."
-fi
+	unsetopt flow_control 			# Let me use ^S and ^Q
+	# bindkey '\e[A' directory-history-search-backward
+	# bindkey '\e[B' directory-history-search-forward
 
-case $os in
-	freebsd)
-		source $ZDOTDIR/freebsd.zsh
-		;;
-	osx)
-		source $ZDOTDIR/osx.zsh
-		;;
-esac
+	bindkey -M emacs '^R' history-substring-search-up
+	bindkey -M emacs '^S' history-substring-search-down
+fi
diff --git a/tag-zsh/fasdrc b/tag-zsh/fasdrc
deleted file mode 100644
index 22259d72..00000000
--- a/tag-zsh/fasdrc
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- mode: sh; -*-
-current () {
-	for path in *; do
-		printf "./%s|1\\n" "$path"
-	done
-}
-
-alias e="f -t -e $EDITOR -B current"