dotfiles/zsh/zshrc.org

1.5 KiB

ZSH

Autoload any ZSH function from $HOME/.zsh/functions.

  fpath=($HOME/.zsh/functions $fpath)
  autoload -U $HOME/.zsh/functions/*(:t)

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"

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

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

Initialize completion. This triggers loading of zsh-syntax-highlighting as well.

autoload -Uz compinit
compinit