legacy-dotfiles/zsh/.zshrc

169 lines
5.4 KiB
Bash
Raw Permalink Normal View History

2012-11-09 10:44:45 +01:00
# -*- Mode: shell-script; -*-
2012-11-28 10:18:43 +01:00
autoload -Uz add-zsh-hook
2012-12-04 17:46:11 +01:00
autoload -Uz compinit
autoload -U colors
autoload -Uz vcs_info
# Autoload zsh functions.
fpath=($HOME/.zsh/functions $fpath)
autoload -U $HOME/.zsh/functions/*(:t)
2012-11-28 10:18:43 +01:00
2010-12-05 12:50:00 +01:00
# Setup variables
2013-01-21 01:34:03 +01:00
HISTFILE=$HOME/.zsh/histfile
2011-02-23 21:09:36 +01:00
HISTSIZE=1000
SAVEHIST=1000
2012-11-09 10:44:45 +01:00
2014-07-01 22:47:02 +02:00
export LESS="iFXRS"
2012-11-09 10:44:45 +01:00
export LESS_TERMCAP_mb=$'\e[1;37m'
export LESS_TERMCAP_md=$'\e[1;37m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;47;30m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[0;36m'
2014-07-01 22:47:02 +02:00
export PAGER="less"
2012-11-09 10:44:45 +01:00
# Aliases
alias alpine="alpine -p ""{imap.gmail.com/ssl/user=tom.willemsen@archlinux.us}remote_pinerc"""
alias evolus-pencil="/usr/lib/evolus-pencil-svn/evolus-pencil.sh"
alias grep="grep --color=always"
alias ls="ls -F --color=always"
2016-01-08 11:46:55 +01:00
alias csi="rlwrap csi"
2012-11-09 10:44:45 +01:00
alias mysql="mysql --pager"
2013-11-03 22:53:04 +01:00
alias sbcl="rlwrap sbcl"
2014-08-21 00:14:54 +02:00
alias scrot="/usr/bin/scrot -e 'mv \$f ~/pictures/screenshots/'"
alias myctl="systemctl --user"
2014-12-16 23:09:35 +01:00
alias hla="hla -lmelf_i386"
2015-06-17 11:01:51 +02:00
alias hc="herbstclient"
2016-03-14 12:18:33 +01:00
alias doco="docker-compose"
2011-02-23 21:09:36 +01:00
2013-02-15 00:31:56 +01:00
# Suffix aliases
alias -s pdf="zathura"
2013-04-03 01:55:21 +02:00
alias -s xls="libreoffice"
2013-02-15 00:31:56 +01:00
2014-07-01 22:47:02 +02:00
setopt AUTO_PUSHD # Automatically add to directory stack
setopt CORRECT # Offer to correct my mistakes
setopt EXTENDED_GLOB # Add extra globbing patterns
setopt NOTIFY # Don't wait to show status of jobs
2012-12-04 17:46:11 +01:00
setopt PROMPT_SUBST # Allow for functions in the prompt
2014-07-01 22:47:02 +02:00
setopt HIST_IGNORE_ALL_DUPS # Don't story any duplicate commands
2011-02-23 21:09:36 +01:00
2012-11-10 12:57:14 +01:00
zstyle :compinstall filename '$HOME/.zshrc'
2011-02-23 21:09:36 +01:00
2010-12-05 12:50:00 +01:00
# Enable auto-execution of functions
typeset -ga preexec_functions
typeset -ga precmd_functions
typeset -ga chpwd_functions
2012-12-04 17:46:11 +01:00
add-zsh-hook precmd vcs_info
2010-12-05 12:50:00 +01:00
2015-04-08 15:17:26 +02:00
zstyle ':vcs_info:*' actionformats '%u%c%B%F{1}%a%f%%b %F{3}%s%f:%F{5}%r%f:%F{4}%b%f'
2012-12-04 17:46:11 +01:00
zstyle ':vcs_info:*' enable bzr git hg svn
2015-04-08 15:17:26 +02:00
zstyle ':vcs_info:*' formats '%u%c%F{3}%s%f:%F{5}%r%f:%F{4}%b%f'
zstyle ':vcs_info:*' nvcsformats ''
2012-12-04 17:46:11 +01:00
zstyle ':vcs_info:bzr:*' branchformat '%b'
2014-08-21 00:14:54 +02:00
zstyle ':vcs_info:git:*' check-for-changes 1
zstyle ':vcs_info:*' stagedstr '%F{2}Δ%f'
zstyle ':vcs_info:*' unstagedstr '%F{1}Δ%f'
2012-12-04 17:46:11 +01:00
2010-12-05 12:50:00 +01:00
# Set the prompt.
2015-04-08 15:17:26 +02:00
PROMPT='%T %2~ %B%(?.%F{2}.%F{1})→%b '
RPROMPT='${vcs_info_msg_0_}'
2010-12-05 12:50:00 +01:00
2012-11-09 10:44:45 +01:00
# Set terminal name to current running application
2010-12-05 12:50:00 +01:00
case $TERM in
2014-07-01 22:47:02 +02:00
eterm-color*)
# Make {{ansi,multi}-,}term change Emacs' `default-directory'
# and keep track of the current user and host.
precmd () { print -P "\eAnSiTu %n\n\eAnSiTc %~" }
;;
2010-12-05 12:50:00 +01:00
rxvt*)
2014-08-21 00:14:54 +02:00
precmd () { print -Pn "\e]0;%m: %~\a" }
preexec () { print -Pn "\e]0;%m: $1\a" }
2010-12-05 12:50:00 +01:00
;;
2014-07-01 22:47:02 +02:00
screen)
# Make screen show the current running command as window title
# or the shell if no command is running. The running command
# is presented as the first sequence of characters without a
# space on the given command line, possibly prefixed with
# `sudo '.
preexec () { print -Pn "\ek$(basename $1 | sed -e 's/^\(\(sudo \)\?[^ ]\+\).*/\1/')\e\\" }
precmd () { print -Pn "\ek$(basename $SHELL)\e\\" }
;;
2010-12-05 12:50:00 +01:00
esac
2013-05-15 15:59:14 +02:00
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
2013-11-03 22:53:04 +01:00
zle -N emacs-backward-kill-word
2014-07-01 22:47:02 +02:00
zle -N insert-sudo
2013-11-03 22:53:04 +01:00
2010-12-05 12:50:00 +01:00
# Set terminal keys
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\e0c" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\e0d" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey -s "^Xb" $'cd -\n'
2010-12-05 12:50:00 +01:00
## for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
## for non RH/Debian xterm, can't hurt for RH/Debian xterm
bindkey "\e0H" beginning-of-line
bindkey "\e0F" end-of-line
## for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
2011-01-11 13:39:45 +01:00
2012-02-13 23:15:41 +01:00
bindkey "^W" backward-delete-char
2013-11-03 22:53:04 +01:00
bindkey "^\b" emacs-backward-kill-word
2014-07-01 22:47:02 +02:00
bindkey "^[#" insert-sudo
2013-11-03 22:53:04 +01:00
source ~/.zsh/antigen/antigen.zsh
antigen bundle zsh-users/zsh-autosuggestions
2013-11-03 22:53:04 +01:00
antigen bundle zsh-users/zsh-syntax-highlighting
2012-02-13 23:15:41 +01:00
antigen apply
# Show syntax highlighting when we're not running in emacs
2012-07-25 22:40:50 +02:00
if [ -z $EMACS ]; then
2013-11-03 22:53:04 +01:00
# source $HOME/.zsh/syntax-highlighting/zsh-syntax-highlighting.zsh
2013-05-23 02:43:14 +02:00
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[function]='fg=blue'
2012-07-25 22:40:50 +02:00
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue'
2013-05-23 02:43:14 +02:00
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[assign]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=red'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=green'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[bracket-level-5]='fg=blue'
ZSH_HIGHLIGHT_STYLES[bracket-level-6]='fg=magenta'
2012-07-25 22:40:50 +02:00
fi
2012-12-04 17:46:11 +01:00
compinit
colors # Initialize colors.
2015-06-17 11:02:04 +02:00
cdpath=($HOME/projects $HOME/projects/work/photension)
2016-03-14 12:19:35 +01:00
# Add filename completion for send-pkg, any file ending in .pkg.tar.xz
compdef '_files -g "*.pkg.tar.xz"' send-pkg