chezmoi/dot_config/oh-my-zsh/custom/02_zplug.zsh
2020-07-14 10:21:51 +02:00

233 lines
9.9 KiB
Bash

# =============================================================================
# Plugins
# =============================================================================
export ZPLUG_LOADED=blabla
# Check if zplug is installed
[ ! -d ~/.zplug ] && git clone https://github.com/zplug/zplug ~/.zplug
# enable zplug
source ~/.zplug/init.zsh
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
# Because your terminal should be able to perform tasks asynchronously without external tools!
zplug "mafredri/zsh-async", from:github, use:async.zsh
# introduce 256 colors in terminal
zplug "chrissicool/zsh-256color"
# not sure what anyframe does... allows other plugins to function? works with fzf
zplug "mollifier/anyframe"
if zplug check "mollifier/anyframe"; then
# expressly specify to use peco
#zstyle ":anyframe:selector:" use peco
# expressly specify to use percol
#zstyle ":anyframe:selector:" use percol
# expressly specify to use fzf-tmux
#zstyle ":anyframe:selector:" use fzf-tmux
# expressly specify to use fzf
zstyle ":anyframe:selector:" use fzf
# specify path and options for peco, percol, or fzf
#zstyle ":anyframe:selector:peco:" command 'peco --no-ignore-case'
#zstyle ":anyframe:selector:percol:" command 'percol --case-sensitive'
#zstyle ":anyframe:selector:fzf-tmux:" command 'fzf-tmux --extended'
#zstyle ":anyframe:selector:fzf:" command 'fzf --extended'
#zstyle ":anyframe:selector:fzf:" command 'fzf'
#bindkey '^@' anyframe-widget-cd-ghq-repository
#bindkey '^r' anyframe-widget-put-history
fi
# print a github style calendar in terminal
zplug "k4rthik/git-cal", as:command
# Simplistic interactive filtering tool
zplug "peco/peco", as:command, from:gh-r, use:"*${(L)$(uname -s)}*amd64*"
# fzf is a general-purpose command-line fuzzy finder.
zplug "junegunn/fzf-bin", as:command, from:gh-r, rename-to:fzf, use:"*${(L)$(uname -s)}*amd64*"
if zplug check "junegunn/fzf-bin"; then
export FZF_DEFAULT_OPTS="--height 40% --reverse --border --inline-info --color=dark,bg+:235,hl+:10,pointer:5"
fi
zplug "junegunn/fzf", use:"shell/*.zsh"
# C^x C^x to launch fzf?
zplug "b4b4r07/easy-oneliner", if:"which fzf", on:"junegunn/fzf-bin"
# Enhanced cd
zplug "b4b4r07/enhancd", use:init.sh
if zplug check "b4b4r07/enhancd"; then
ENHANCD_FILTER="fzf:peco:percol"
# type 'c' and get a list of likely dirs you want to go to
ENHANCD_COMMAND="c"
fi
# Bookmarks and jump
zplug "jocelynmallon/zshmarks"
# Enhanced dir list with git features
zplug "supercrabtree/k"
# Jump back to parent directory
zplug "tarrasch/zsh-bd"
# Simple zsh calculator
zplug "arzzen/calc.plugin.zsh"
# Directory colors
zplug "seebi/dircolors-solarized", ignore:"*", as:plugin
zplug "pinelibg/dircolors-solarized-zsh"
zplug "plugins/common-aliase", from:oh-my-zsh
zplug "plugins/command-not-found", from:oh-my-zsh
zplug "plugins/copydir", from:oh-my-zsh
zplug "plugins/copyfile", from:oh-my-zsh
zplug "plugins/cp", from:oh-my-zsh
zplug "plugins/dircycle", from:oh-my-zsh
zplug "plugins/encode64", from:oh-my-zsh
zplug "plugins/extract", from:oh-my-zsh
zplug "plugins/history", from:oh-my-zsh
zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/tmuxinator", from:oh-my-zsh
zplug "plugins/urltools", from:oh-my-zsh
zplug "plugins/web-search", from:oh-my-zsh
zplug "plugins/z", from:oh-my-zsh
zplug "plugins/fancy-ctrl-z", from:oh-my-zsh
# Supports oh-my-zsh plugins and the like
if [[ $OSTYPE = (linux)* ]]; then
zplug "plugins/archlinux", from:oh-my-zsh, if:"(( $+commands[pacman] ))"
zplug "plugins/dnf", from:oh-my-zsh, if:"(( $+commands[dnf] ))"
zplug "plugins/mock", from:oh-my-zsh, if:"(( $+commands[mock] ))"
fi
zplug "plugins/git", from:oh-my-zsh, if:"(( $+commands[git] ))"
zplug "plugins/golang", from:oh-my-zsh, if:"(( $+commands[go] ))"
zplug "plugins/svn", from:oh-my-zsh, if:"(( $+commands[svn] ))"
zplug "plugins/node", from:oh-my-zsh, if:"(( $+commands[node] ))"
zplug "plugins/npm", from:oh-my-zsh, if:"(( $+commands[npm] ))"
zplug "plugins/bundler", from:oh-my-zsh, if:"(( $+commands[bundler] ))"
zplug "plugins/gem", from:oh-my-zsh, if:"(( $+commands[gem] ))"
zplug "plugins/rvm", from:oh-my-zsh, if:"(( $+commands[rvm] ))"
zplug "plugins/pip", from:oh-my-zsh, if:"(( $+commands[pip] ))"
zplug "plugins/sudo", from:oh-my-zsh, if:"(( $+commands[sudo] ))"
zplug "plugins/gpg-agent", from:oh-my-zsh, if:"(( $+commands[gpg-agent] ))"
zplug "plugins/systemd", from:oh-my-zsh, if:"(( $+commands[systemctl] ))"
zplug "plugins/docker", from:oh-my-zsh, if:"(( $+commands[docker] ))"
zplug "plugins/docker-compose", from:oh-my-zsh, if:"(( $+commands[docker-compose] ))"
zplug "plugins/terraform", from:oh-my-zsh, if:"(( $+commands[terraform] ))"
zplug "plugins/vagrant", from:oh-my-zsh, if:"(( $+commands[vagrant] ))"
zplug "djui/alias-tips"
zplug "hlissner/zsh-autopair", defer:2
# Additional completion definitions for Zsh.
zplug "zsh-users/zsh-completions"
# Suggests commands as you type based on history and completions.
zplug "zsh-users/zsh-autosuggestions"
if zplug check "zsh-users/zsh-autosuggestions"; then
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=075' #color could be adjusted to theme
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=162'
fi
# zsh-syntax-highlighting must be loaded after executing compinit command and sourcing other plugins
zplug "zsh-users/zsh-syntax-highlighting", defer:2
if zplug check "zsh-users/zsh-syntax-highlighting"; then
typeset -gA ZSH_HIGHLIGHT_STYLES ZSH_HIGHLIGHT_PATTERNS
ZSH_HIGHLIGHT_STYLES[default]='none'
ZSH_HIGHLIGHT_STYLES[cursor]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[function]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[command]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=green'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green'
ZSH_HIGHLIGHT_STYLES[path]='fg=white,underline'
ZSH_HIGHLIGHT_STYLES[path_pathseparator]='fg=grey,underline'
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=white'
ZSH_HIGHLIGHT_STYLES[path_approx]='fg=white'
ZSH_HIGHLIGHT_STYLES[globbing]='none'
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=green'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue'
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[redirection]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=cyan,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=magenta,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=yellow,bold'
ZSH_HIGHLIGHT_STYLES[assign]='none'
ZSH_HIGHLIGHT_PATTERNS=('rm -rf *' 'fg=white,bold,bg=red')
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor line)
fi
# search in zsh history
zplug "zsh-users/zsh-history-substring-search", defer:3
if zplug check "zsh-users/zsh-history-substring-search"; then
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey "^[[1;5A" history-substring-search-up
bindkey "^[[1;5B" history-substring-search-down
fi
# Finalise the zplug section, install and load
# Install plugins if there are plugins that have not been installed
if ! zplug check; then
printf "Install plugins? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# zplug load is called in the last stage (see other ./custom files)
# Completions
# the internal list (hash) of commands will be updated for each search by issuing the rehash command
zstyle ':completion:*' rehash true
# http://zsh.sourceforge.net/Doc/Release/Completion-System.html
zstyle ':completion:' completer _complete _match _approximate
zstyle ':completion:' group-name ''
#zstyle ':completion:' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:' use-cache true
zstyle ':completion:' verbose yes
zstyle ':completion::default' menu select=2
zstyle ':completion::descriptions' format '%F{yellow}-- %d --%f'
zstyle ':completion:*:options' description 'yes'
# case-insensitive (uppercase from lowercase) completion
#zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# process completion
#zstyle ':completion:*:processes' command 'ps -au$USER'
#zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
zstyle ':completion:*' completer _expand _complete _ignored _approximate
#zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*:descriptions' format '%U%F{yellow}%d%f%u'
#zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''
# case-insensitive (all), partial-word and then substring completion
zstyle ":completion:*" matcher-list \
"m:{a-zA-Z}={A-Za-z}" \
"r:|[._-]=* r:|=*" \
"l:|=* r:|=*"
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:default' list-colors "${(s.:.)LS_COLORS}"