From b60c2bce1d75c1bec335b30d9e623cd3682b5a88 Mon Sep 17 00:00:00 2001 From: Joachim Nielandt Date: Wed, 15 Jul 2020 11:12:05 +0200 Subject: [PATCH] Moved plugins to zplugin, still needs configuration - way faster --- .../{02_zplug.zsh => 02_zplug.zsh.depr} | 0 dot_dotfiles/oh-my-zsh/custom/02_zplugin.zsh | 163 ++++++++++++++++++ dot_dotfiles/oh-my-zsh/custom/10_finalise.zsh | 5 +- dot_fzf.zsh | 13 ++ dot_zshrc | 14 +- 5 files changed, 187 insertions(+), 8 deletions(-) rename dot_dotfiles/oh-my-zsh/custom/{02_zplug.zsh => 02_zplug.zsh.depr} (100%) create mode 100644 dot_dotfiles/oh-my-zsh/custom/02_zplugin.zsh create mode 100644 dot_fzf.zsh diff --git a/dot_dotfiles/oh-my-zsh/custom/02_zplug.zsh b/dot_dotfiles/oh-my-zsh/custom/02_zplug.zsh.depr similarity index 100% rename from dot_dotfiles/oh-my-zsh/custom/02_zplug.zsh rename to dot_dotfiles/oh-my-zsh/custom/02_zplug.zsh.depr diff --git a/dot_dotfiles/oh-my-zsh/custom/02_zplugin.zsh b/dot_dotfiles/oh-my-zsh/custom/02_zplugin.zsh new file mode 100644 index 0000000..89b94e9 --- /dev/null +++ b/dot_dotfiles/oh-my-zsh/custom/02_zplugin.zsh @@ -0,0 +1,163 @@ +### ZINIT +if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then + print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f" + command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit" + command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \ + print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \ + print -P "%F{160}▓▒░ The clone has failed.%f%b" +fi + +source "$HOME/.zinit/bin/zinit.zsh" +autoload -Uz _zinit +(( ${+_comps} )) && _comps[zinit]=_zinit + +# Load a few important annexes, without Turbo +# (this is currently required for annexes) +zinit light-mode for \ + zinit-zsh/z-a-rust \ + zinit-zsh/z-a-as-monitor \ + zinit-zsh/z-a-patch-dl \ + zinit-zsh/z-a-bin-gem-node + +# Because your terminal should be able to perform tasks asynchronously without external tools! +zinit light mafredri/zsh-async + +# Introduce 256 colors in terminal +zplugin light chrissicool/zsh-256color + +# What the hell does this do? +zinit light mollifier/anyframe +zstyle ":anyframe:selector:" use fzf + +# print github style calendar +zinit ice as"program" atclone'perl Makefile.PL PREFIX=$ZPFX' \ + atpull'%atclone' make'install' pick"$ZPFX/bin/git-cal" +zinit light k4rthik/git-cal + +# simplistic interactive filtering tool +zinit light peco/peco + +# use package manager to install fzf (straight from github?) +zinit pack for fzf + +# C^x C^x to launch fzf? +zinit light b4b4r07/easy-oneliner + +# search in zsh history +zinit light zsh-users/zsh-history-substring-search + +# Enhanced CD command +# wait lucid > suppress output on console, messes with p10 setup +zinit wait lucid light-mode for \ + b4b4r07/enhancd + +# Oh-My-Zsh plugins +zinit snippet OMZ::plugins/git/git.plugin.zsh + +# Bookmarks and jump +zinit light jocelynmallon/zshmarks + +# Enhanced dir list with git features +zinit light supercrabtree/k + +# Jump back to parent directory +zinit light tarrasch/zsh-bd + +# Simple zsh calculator +# Usage: $ calc 5+4 +# TODO figure out mismatch with zsh-syntax-highlighting (= is invalid alias) +#zinit light arzzen/calc.plugin.zsh + +zinit light djui/alias-tips +zinit light hlissner/zsh-autopair + + +# Additional completion definitions for Zsh. +zinit light zsh-users/zsh-completions + +# Suggests commands as you type based on history and completions. +zinit light zsh-users/zsh-autosuggestions + +# zsh-syntax-highlighting must be loaded after executing compinit command and sourcing other plugins +zinit load zsh-users/zsh-syntax-highlighting + +# search in zsh history +zinit light zsh-users/zsh-history-substring-search +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 + +# oh-my-zsh plugins +zinit snippet OMZ::plugins/archlinux +zinit snippet OMZ::plugins/bundler +zinit snippet OMZ::plugins/command-not-found +zinit snippet OMZ::plugins/common-aliases +zinit snippet OMZ::plugins/copydir +zinit snippet OMZ::plugins/copyfile +zinit snippet OMZ::plugins/cp +zinit snippet OMZ::plugins/cp +zinit snippet OMZ::plugins/dircycle +zinit snippet OMZ::plugins/dnf +zinit snippet OMZ::plugins/docker-compose +zinit snippet OMZ::plugins/encode64 +zinit snippet OMZ::plugins/extract +zinit snippet OMZ::plugins/fancy-ctrl-z +zinit snippet OMZ::plugins/gem +zinit snippet OMZ::plugins/git +zinit snippet OMZ::plugins/git/git.plugin.zsh +zinit snippet OMZ::plugins/golang +zinit snippet OMZ::plugins/gpg-agent +zinit snippet OMZ::plugins/history +zinit snippet OMZ::plugins/node +zinit snippet OMZ::plugins/npm +zinit snippet OMZ::plugins/pip +zinit snippet OMZ::plugins/rvm +zinit snippet OMZ::plugins/sudo +zinit snippet OMZ::plugins/svn +zinit snippet OMZ::plugins/systemd +zinit snippet OMZ::plugins/terraform +zinit snippet OMZ::plugins/tmux +zinit snippet OMZ::plugins/tmuxinator +zinit snippet OMZ::plugins/urltools +zinit snippet OMZ::plugins/vagrant +zinit snippet OMZ::plugins/web-search + + +# 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}" diff --git a/dot_dotfiles/oh-my-zsh/custom/10_finalise.zsh b/dot_dotfiles/oh-my-zsh/custom/10_finalise.zsh index 50be801..26b914d 100644 --- a/dot_dotfiles/oh-my-zsh/custom/10_finalise.zsh +++ b/dot_dotfiles/oh-my-zsh/custom/10_finalise.zsh @@ -1,6 +1,7 @@ -# Load the zplug plugins -zplug load +# load fzf +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # Set up SDKMAN export SDKMAN_DIR="/home/jnieland/.sdkman" [[ -s "/home/jnieland/.sdkman/bin/sdkman-init.sh" ]] && source "/home/jnieland/.sdkman/bin/sdkman-init.sh" + diff --git a/dot_fzf.zsh b/dot_fzf.zsh new file mode 100644 index 0000000..89be3a3 --- /dev/null +++ b/dot_fzf.zsh @@ -0,0 +1,13 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == */home/jnieland/.fzf/bin* ]]; then + export PATH="${PATH:+${PATH}:}/home/jnieland/.fzf/bin" +fi + +# Auto-completion +# --------------- +[[ $- == *i* ]] && source "/home/jnieland/.fzf/shell/completion.zsh" 2> /dev/null + +# Key bindings +# ------------ +source "/home/jnieland/.fzf/shell/key-bindings.zsh" diff --git a/dot_zshrc b/dot_zshrc index f8bc5d0..d91bc10 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -5,6 +5,12 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] #source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi +# Finally, source custom scripts that are global for zsh. These are useful to override things from powerlevel10k, +# oh-my-zsh, ... +for file in ~/.dotfiles/zsh/custom/*.zsh; do + source "$file" +done + # Path to your oh-my-zsh installation. ZSH=/usr/share/oh-my-zsh/ @@ -72,7 +78,7 @@ ZSH_CUSTOM=$HOME/.config/oh-my-zsh/custom/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git) +plugins=(git docker) ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh if [[ ! -d $ZSH_CACHE_DIR ]]; then @@ -87,8 +93,4 @@ source $ZSH/oh-my-zsh.sh # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.dotfiles/.p10k.zsh ]] || source ~/.dotfiles/.p10k.zsh -# Finally, source custom scripts that are global for zsh. These are useful to override things from powerlevel10k, -# oh-my-zsh, ... -for file in ~/.dotfiles/zsh/custom/*.zsh; do - source "$file" -done +