2.2 KiB
ZSH
Autoload any ZSH function from $HOME/.zsh/functions
.
fpath=($HOME/.zsh/functions $fpath)
autoload -U $HOME/.zsh/functions/*(:t)
Aliases
Use rlwrap on some less-than-pleasant REPLs that don't have GNU Readline-like features themselves.
alias csi="rlwrap csi"
alias scsh="rlwrap scsh"
alias sbcl="rlwrap sbcl"
History
Store ZSH history in a non-intrusive place.
HISTFILE=$HOME/.zsh/histfile
Keep at most 1000 previous commands in memory.
HISTSIZE=1000
Save at most 1000 previous commands to disk.
SAVEHIST=1000
Allow multiple shell instances to share the same history.
setopt SHARE_HISTORY
Don't remember duplicated commands.
setopt HIST_IGNORE_ALL_DUPS
Plug-ins
Load zplug, a next generation zsh plugin manager.
source /usr/share/zsh/scripts/zplug/init.zsh
Add zsh-syntax-highlighting.
zplug "zsh-users/zsh-syntax-highlighting", nice:10
Add zsh-autosuggestions.
zplug "zsh-users/zsh-autosuggestions"
Add bgnotify from oh-my-zsh to show when long-running commands finish.
zplug "plugins/bgnotify", from:oh-my-zsh
Make sure all plugins are installed.
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
Load all plugins.
zplug load --verbose
X Interaction
Make some widgets for interacting with the clipboard.
zle -N x-copy-region-as-kill
zle -N x-kill-region
zle -N x-yank
Bind them to keyboard shortcuts.
bindkey -e '^[w' x-copy-region-as-kill
bindkey -e '^W' x-kill-region
bindkey -e '^Y' x-yank
Completion
Initialize completion. This triggers loading of zsh-syntax-highlighting as well.
autoload -Uz compinit
compinit