2016-10-19 22:52:25 +02:00
|
|
|
#+TITLE: ZSH
|
|
|
|
|
|
|
|
Autoload any ZSH function from =$HOME/.zsh/functions=.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
fpath=($HOME/.zsh/functions $fpath)
|
|
|
|
autoload -U $HOME/.zsh/functions/*(:t)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Use rlwrap on some less-than-pleasant REPLs that don't have GNU
|
|
|
|
Readline-like features themselves.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
alias csi="rlwrap csi"
|
|
|
|
alias scsh="rlwrap scsh"
|
|
|
|
#+END_SRC
|
2016-10-20 14:56:29 +02:00
|
|
|
|
|
|
|
Load zplug, a next generation zsh plugin manager.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
source /usr/share/zsh/scripts/zplug/init.zsh
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Add zsh-syntax-highlighting.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
zplug "zsh-users/zsh-syntax-highlighting", nice:10
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Add zsh-autosuggestions.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
zplug "zsh-users/zsh-autosuggestions"
|
|
|
|
#+END_SRC
|
|
|
|
|
2016-10-21 14:41:21 +02:00
|
|
|
Add bgnotify from oh-my-zsh to show when long-running commands finish.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
zplug "plugins/bgnotify", from:oh-my-zsh
|
|
|
|
#+END_SRC
|
|
|
|
|
2016-10-20 14:56:29 +02:00
|
|
|
Make sure all plugins are installed.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
if ! zplug check --verbose; then
|
|
|
|
printf "Install? [y/N]: "
|
|
|
|
if read -q; then
|
|
|
|
echo; zplug install
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Load all plugins.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
zplug load --verbose
|
|
|
|
#+END_SRC
|
|
|
|
|
2016-10-21 14:51:21 +02:00
|
|
|
Make some widgets for interacting with the clipboard.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
zle -N x-copy-region-as-kill
|
|
|
|
zle -N x-kill-region
|
|
|
|
zle -N x-yank
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Bind them to keyboard shortcuts.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
bindkey -e '^[w' x-copy-region-as-kill
|
|
|
|
bindkey -e '^W' x-kill-region
|
|
|
|
bindkey -e '^Y' x-yank
|
|
|
|
#+END_SRC
|
|
|
|
|
2016-10-20 14:56:29 +02:00
|
|
|
Initialize completion. This triggers loading of
|
|
|
|
zsh-syntax-highlighting as well.
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
autoload -Uz compinit
|
|
|
|
compinit
|
|
|
|
#+END_SRC
|