2012-07-03 17:21:48 +02:00
|
|
|
## -*- mode:sh -*- #
|
2012-06-15 16:54:02 +02:00
|
|
|
## Zsh specific options
|
|
|
|
|
2013-07-26 15:16:15 +02:00
|
|
|
ZCACHE=~/.cache/zsh/
|
|
|
|
[ ! -e "$ZCACHE" ] && mkdir -p "$ZCACHE"
|
|
|
|
|
2012-06-15 16:54:02 +02:00
|
|
|
##==============================================================================
|
|
|
|
## History options
|
2014-11-12 17:22:59 +01:00
|
|
|
|
2013-07-26 15:16:15 +02:00
|
|
|
HISTFILE="$ZCACHE/history"
|
2012-08-13 18:18:56 +02:00
|
|
|
HISTSIZE=1000
|
|
|
|
SAVEHIST=1000
|
|
|
|
setopt hist_ignore_all_dups
|
|
|
|
setopt hist_ignore_space # Commands beginning with a space won't be recorded.
|
|
|
|
setopt appendhistory
|
2012-06-15 16:54:02 +02:00
|
|
|
|
|
|
|
##==============================================================================
|
2012-08-13 18:18:56 +02:00
|
|
|
## Misc
|
2014-11-12 17:22:59 +01:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Not recommended.
|
|
|
|
# setopt completealiases
|
|
|
|
|
|
|
|
setopt autocd # When only dirname is entered, then auto cd to it.
|
|
|
|
|
|
|
|
## ???
|
|
|
|
# setopt extendedglob nomatch notify
|
|
|
|
|
|
|
|
## Usually not needed if pc speaker is off.
|
|
|
|
unsetopt beep
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2013-07-24 09:04:01 +02:00
|
|
|
## Turn of ^s so it does not freeze output.
|
|
|
|
unsetopt flowcontrol
|
|
|
|
|
2012-06-15 16:54:02 +02:00
|
|
|
##==============================================================================
|
|
|
|
## VCS
|
2014-11-12 17:22:59 +01:00
|
|
|
|
|
|
|
## TODO: Configure vcs style for zsh.
|
2013-07-26 15:16:15 +02:00
|
|
|
# autoload -Uz vcs_info zstyle ':vcs_info:*' enable git hg
|
2012-06-15 16:54:02 +02:00
|
|
|
# autoload -Uz vcs_info
|
|
|
|
|
|
|
|
##==============================================================================
|
2012-08-13 18:18:56 +02:00
|
|
|
## Directory stack
|
2013-05-06 10:42:40 +02:00
|
|
|
|
2013-07-26 15:16:15 +02:00
|
|
|
## We use expanded path for DIRSTACKFILE since we need to locate it for the
|
|
|
|
## zshcd script.
|
|
|
|
DIRSTACKFILE="$HOME/.cache/zsh/dirs"
|
2013-05-06 10:42:40 +02:00
|
|
|
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
|
|
|
|
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
|
|
|
|
[[ -d $dirstack[1] ]] && cd $dirstack[1]
|
|
|
|
fi
|
|
|
|
chpwd() {
|
|
|
|
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE
|
|
|
|
}
|
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
DIRSTACKSIZE=20
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
setopt autopushd pushdsilent pushdtohome
|
|
|
|
setopt pushdignoredups
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2013-05-06 10:42:40 +02:00
|
|
|
## This reverts the +/- operators.
|
2013-02-05 23:48:09 +01:00
|
|
|
setopt pushdminus
|
2012-06-15 16:54:02 +02:00
|
|
|
|
|
|
|
##==============================================================================
|
|
|
|
## Completion
|
2014-11-12 17:22:59 +01:00
|
|
|
|
2013-01-26 13:32:43 +01:00
|
|
|
## Custom completion
|
2013-06-20 17:26:37 +02:00
|
|
|
## TODO: this is quite slow. Why?
|
2013-01-26 13:32:43 +01:00
|
|
|
fpath=(~/.shell.d/completion $fpath)
|
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
autoload -Uz compinit
|
2013-07-26 15:16:15 +02:00
|
|
|
# compinit
|
|
|
|
compinit -d "$ZCACHE/compdump"
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
zstyle ':completion:*' menu select
|
|
|
|
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
|
|
|
|
zstyle ':completion:*:commands' rehash true # New binaries in path get recognized.
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
zstyle ':completion:*' completer _complete _match _approximate ## Allow approximate
|
|
|
|
zstyle ':completion:*:match:*' original only
|
|
|
|
zstyle ':completion:*:approximate:*' max-errors 1 numeric
|
2012-06-15 16:54:02 +02:00
|
|
|
|
|
|
|
## Tab completion for PID :D -- Useless ?
|
2012-08-13 18:18:56 +02:00
|
|
|
# zstyle ':completion:*:*:kill:*' menu yes select
|
|
|
|
# zstyle ':completion:*:kill:*' force-list always
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2014-11-12 17:22:59 +01:00
|
|
|
## ???
|
|
|
|
# zstyle :compinstall filename "$HOME/.zshrc"
|
|
|
|
|
2012-06-15 16:54:02 +02:00
|
|
|
##==============================================================================
|
|
|
|
## TESTING
|
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Remove RPS1 after <enter>
|
|
|
|
setopt transient_rprompt
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Color vars
|
|
|
|
autoload -U colors terminfo
|
|
|
|
colors
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Zargs powaa
|
|
|
|
autoload -U zargs
|
2012-06-15 16:54:02 +02:00
|
|
|
|
|
|
|
##==============================================================================
|
2012-08-13 18:18:56 +02:00
|
|
|
## Prompt
|
2014-11-12 17:22:59 +01:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
autoload -U promptinit
|
|
|
|
promptinit
|
|
|
|
prompt adam2
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2015-11-07 10:00:42 +01:00
|
|
|
##==============================================================================
|
|
|
|
## fzf (external)
|
|
|
|
|
2016-01-20 05:04:24 +01:00
|
|
|
if [ -f /etc/profile.d/fzf.zsh ]; then
|
|
|
|
. /etc/profile.d/fzf.zsh
|
|
|
|
bindkey '^T' transpose-chars
|
|
|
|
bindkey '\er' fzf-file-widget
|
|
|
|
fi
|