zshuper/main.zsh

98 lines
2.5 KiB
Bash

# zshuper - pronounced as '/ʃ/uper'
#
# Edit config.zsh to configure zshuper
# Source this script like:
# % source ~/.config/zshuper/main.zsh
#
# Load config
source ~/.config/zshuper/config.zsh
# ---------------------------------
# 3rd party plugins
# Check if zplug is installed
if [ ! -d "${ZPLUG_HOME}" ]; then
echo ">>> Installing zplug"
git clone --depth=1 https://github.com/zplug/zplug ${ZPLUG_HOME}
fi
# Include zplug
source ${ZPLUG_HOME}/init.zsh
# Let zplug manage itself
zplug "zplug/zplug"
# Include own plugins
source ~/.config/zshuper/plugins.zsh
# And include highlighting at the end
# https://github.com/zsh-users/zsh-syntax-highlighting#faq
zplug "zsh-users/zsh-syntax-highlighting", defer:2
# Install and load plugins
if ! zplug check; then
zplug install
fi
zplug load
# ---------------------------------
# zshuper specific configuration
# Set up sane defaults and useful functions
# Use grml PS1 (if enabled)
# https://grml.org/zsh/
if [ "${USE_GRML_PS1}" = "yes" ]; then
PS1="%B%F{red}%(?..%? )%f%b%B%F{blue}%n%f%b@%m %B%40<..<%~%<< %b%# "
fi
# Default editor and pager
# cool people use neovim :>
export EDITOR=$(if [ ! -z "$(command -v nvim)" ]; then echo "nvim"; else echo "vim"; fi)
export VISUAL=${EDITOR}
export PAGER=less
export MANPAGER=less
# less options
export LESS="-r"
# History control
setopt histignorealldups
setopt extended_history
setopt append_history
setopt histignorespace
unsetopt share_history
setopt histallowclobber
setopt INC_APPEND_HISTORY_TIME
HISTSIZE=100000
SAVEHIST=100000
HISTFILE=~/.zsh_history
# Enable comments in interactive shell
setopt interactivecomments
# Show program exit code and don't check for jobs on exit
setopt printexitvalue
setopt nocheckjobs
# Set up autocompletion and correction
autoload -U compinit && compinit
setopt menu_complete
zstyle ':completion:*' menu select
zstyle ':completion:*:warnings' format 'Nuffin there :('
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' completer _expand_alias _complete _approximate
zstyle ':completion:*:approximate:*' max-errors 4
zstyle ':completion:*' special-dirs true
# zshuper functions
source ~/.config/zshuper/functions/aliases.zsh
source ~/.config/zshuper/functions/keys.zsh
source ~/.config/zshuper/functions/new-scratch.zsh
source ~/.config/zshuper/functions/rationalise-dot.zsh
source ~/.config/zshuper/functions/use-zaw-search.zsh
source ~/.config/zshuper/functions/correct.zsh
source ~/.config/zshuper/functions/pacman.zsh
source ~/.config/zshuper/functions/hosts-completion.zsh