Some cleaning to `.zshrc` and dedicated loading of autosuggestions and syntax-highlighting plugins

master
Meliurwen 3 years ago
parent af75d08865
commit 52071861a9
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 34
      zsh/.zshrc

@ -3,6 +3,7 @@
# See: # See:
# - https://zsh.sourceforge.io/Doc/Release/ # - https://zsh.sourceforge.io/Doc/Release/
# - https://stevenvanbael.com/profiling-zsh-startup # - https://stevenvanbael.com/profiling-zsh-startup
# - https://zsh.sourceforge.io/Doc/Release/Options.html
### History ### History
HISTFILE="$HOME/.zsh_history" HISTFILE="$HOME/.zsh_history"
@ -85,9 +86,7 @@ fi
autoload -U compinit autoload -U compinit
# Save the location of the current completion dump file. # Save the location of the current completion dump file.
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}" compinit -u -C -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/.zcompdump-${ZSH_VERSION}"
compinit -u -C -d "${ZSH_COMPDUMP}"
### Completion ### Completion
zmodload -i zsh/complist zmodload -i zsh/complist
@ -113,14 +112,14 @@ zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm -w -w" zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
# disable named-directories autocompletion # disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable # Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion:*' use-cache yes zstyle ':completion:*' use-cache yes
zstyle ':completion:*' cache-path "$HOME/.cache/zsh" zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
# Don't complete uninteresting users # Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \ zstyle ':completion:*:*:*:users' ignored-patterns \
@ -139,12 +138,6 @@ zstyle '*' single-ignored show
# automatically load bash completion functions # automatically load bash completion functions
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
zsh_asugg_path="/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
zsh_shigh_path="/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
[ -f "${zsh_asugg_path}" ] && . "${zsh_asugg_path}"
[ -f "${zsh_shigh_path}" ] && . "${zsh_shigh_path}"
unset zsh_asugg_path zsh_shigh_path
### Addons ### Addons
# Colored manpages # Colored manpages
man() { man() {
@ -161,23 +154,17 @@ man() {
# Colored `ls` command and colored dir and files suggestions # Colored `ls` command and colored dir and files suggestions
autoload -U colors && colors autoload -U colors && colors
# For GNU ls, we use the default ls color theme.
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then if [[ -z "$LS_COLORS" ]]; then
# For GNU ls, we use the default ls color theme.
# They can later be overwritten by themes.
if [[ -z "$LS_COLORS" ]]; then
(( $+commands[dircolors] )) && eval "$(dircolors -b)" (( $+commands[dircolors] )) && eval "$(dircolors -b)"
fi
# Take advantage of $LS_COLORS for completion as well.
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
fi fi
# Take advantage of $LS_COLORS for completion as well.
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# TODO: check what `multios` really does # TODO: check what `multios` really does
# See: http://zsh.sourceforge.net/Doc/Release/Options.html # See: http://zsh.sourceforge.net/Doc/Release/Options.html
#setopt auto_cd #setopt auto_cd
setopt multios #setopt multios
### Custom zsh-specific Functions ### Custom zsh-specific Functions
function zsh_stats() { function zsh_stats() {
@ -186,11 +173,10 @@ function zsh_stats() {
grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl
} }
## Theme ## Theme
# This is ugly as hell, but is efficient and reliable # This is ugly as hell, but is efficient and reliable
# TODO: find a clean, reliable and efficient solution to this mess # TODO: find a clean, reliable and efficient solution to this mess
zsh_base_dir="$HOME/.config/zsh" zsh_base_dir="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
# Rudimentary plugin loader # Rudimentary plugin loader
# Note: the files are loaded in alphabetical order # Note: the files are loaded in alphabetical order

Loading…
Cancel
Save