From da52dad3d79e741f9b4706adff4cc2dd10ec6e8e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 19 Feb 2021 12:45:36 +0100 Subject: [PATCH] zsh: Switch from powerlevel10k to pure prompt Switched theme of zsh, just to declutter a little and make startup slightly faster. Removed nvm from automatically initializing to majorly speed up zsh startup times - removing around 750ms on my system. TODO could potentially move to a conditional startup system, in which nvm only gets sourced on its first invocation or similar workarounds. --- bootstrap/packages.txt | 7 ++----- zsh/.config/zsh/.zshenv | 1 - zsh/.config/zsh/.zshrc | 44 ++++++++++++++++++----------------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/bootstrap/packages.txt b/bootstrap/packages.txt index 2082b53..adc7f27 100644 --- a/bootstrap/packages.txt +++ b/bootstrap/packages.txt @@ -15,7 +15,6 @@ bc biber bibtool bison -chromium dhcpcd dialog diff-so-fancy @@ -47,7 +46,6 @@ iputils jabref-latest jpdftweak jq -keybase-bin licenses linux-firmware linux-headers @@ -86,7 +84,6 @@ paru pass pavolume pdfjs -pia-tools picom pkgconf playerctl @@ -152,7 +149,7 @@ xclip xorg-xev xorg-xinit xorg-xinput -youtube-dlc +youtube-dl # zsh plugins alias-tips-git @@ -163,4 +160,4 @@ zathura-pdf-mupdf zsh-autosuggestions zsh-completions-git zsh-fast-syntax-highlighting-git -zsh-theme-powerlevel10k-git +zsh-pure-prompt diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 3b4e6ac..be77cca 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -1,6 +1,5 @@ #!/usr/bin/env zsh # -# # load global sh env vars [ -f "$XDG_CONFIG_HOME/sh/env" ] && source "$XDG_CONFIG_HOME/sh/env" diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 2abc150..7dc2f8d 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -4,13 +4,6 @@ CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}" ZSHCONFDIR="$CONFDIR/zsh" -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block, everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - # Set completion style # The following lines were added by compinstall zstyle ':completion:*' completer _complete _ignored _approximate @@ -22,10 +15,9 @@ zstyle :compinstall filename "$ZSHCONFDIR/.zshrc" # load plugins PLUG_FOLDER="/usr/share/zsh/plugins" -source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh -source /usr/share/nvm/init-nvm.sh +#source /usr/share/nvm/init-nvm.sh [ -e $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh # these need to be sourced after fzf-tab [ -e $PLUG_FOLDER/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh ] && source $PLUG_FOLDER/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh @@ -35,16 +27,16 @@ unset PLUG_FOLDER # simple fzf-tab settings FZF_TAB_COMMAND=( - fzf - --ansi # Enable ANSI color support, necessary for showing groups - --expect='$continuous_trigger,$print_query' # For continuous completion and print query - '--color=hl:$(( $#headers == 0 ? 108 : 255 ))' - --nth=2,3 --delimiter='\x00' # Don't search prefix - --layout=reverse --height='${FZF_TMUX_HEIGHT:=75%}' - --tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle - '--query=$query' # $query will be expanded to query string at runtime. - '--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime - --print-query + fzf + --ansi # Enable ANSI color support, necessary for showing groups + --expect='$continuous_trigger,$print_query' # For continuous completion and print query + '--color=hl:$(( $#headers == 0 ? 108 : 255 ))' + --nth=2,3 --delimiter='\x00' # Don't search prefix + --layout=reverse --height='${FZF_TMUX_HEIGHT:=75%}' + --tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle + '--query=$query' # $query will be expanded to query string at runtime. + '--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime + --print-query ) zstyle ':fzf-tab:*' command $FZF_TAB_COMMAND # format colorful groups for different completion actions @@ -70,9 +62,16 @@ zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps - zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'exa -1 --color=always $realpath' # load completion, extended zsh moving syntax, zle edit in vim (or other $EDITOR) possibility -autoload -Uz compinit zmv edit-command-line +autoload -Uz compinit zmv edit-command-line promptinit compinit +# pure prompt init +promptinit +prompt pure +# make it single line +prompt_newline='%666v' +PROMPT=" $PROMPT" + # shellcheck source=alias [ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias" # load additional aliases @@ -197,10 +196,5 @@ dedup_pathvar() { dedup_pathvar PATH dedup_pathvar MANPATH -# shellcheck is not built for zsh specific uses like p10k does -# so we remove it from being analyzed and linted in shellcheck by adding underscore -# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. -[[ ! -f "$ZSHCONFDIR/.p10k._zsh" ]] || source "$ZSHCONFDIR/.p10k._zsh" - unset CONFDIR unset ZSHCONFDIR