1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
a2ad4853ed
zsh: use ZDOTDIR over XDG_CONFIG_HOME
ZSH is programmed to prefer this ordering, so honor that in the ZSH
configuration as well.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-08-23 16:38:34 +01:00
ecb282cabb
zsh: remove unused edit-command-line zmod
This was added previously for Ctrl+V for vim editing of the
command-line, but the key-bind was removed in
ce595c81b6 but this was forgotten.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-08-23 16:37:59 +01:00
6d33d4685c
zsh: switch to zinit & zsh-fsh
These are significantly faster to load, and are actively maintained.
Functionality is almost identical from a usability perspective.
The primary motivation for this change is the several orders of
magnitude faster shell loading times, which should help with
productivity on overloaded and underpowered hardware.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-08-23 16:34:33 +01:00
5ace0bb7f4
zsh: trysource various ZSH plugins
These vary by OS/distribution and even between devices depending on what
is installed. Most of these are optional anyway so make a best-effort
attempt to load them.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-08-23 12:07:09 +01:00
3 changed files with 103 additions and 64 deletions

View File

@ -1,7 +1,6 @@
# Override paths for non-compliant programs
# https://wiki.archlinux.org/index.php/XDG_Base_Directory_support
ADOTDIR="$XDG_DATA_HOME/zsh/antigen"
ASPELL_CONF="per-conf $XDG_CONFIG_HOME/aspell/aspell.conf; personal $XDG_CONFIG_HOME/aspell/en.pws; repl $XDG_CONFIG_HOME/aspell/en.prepl"
CARGO_HOME="$XDG_DATA_HOME/cargo"
GNUPGHOME="$XDG_CONFIG_HOME/gnupg"

82
fsh/fish.ini Normal file
View File

@ -0,0 +1,82 @@
[base]
default = 12
unknown-token = red,bold
commandseparator = cyan
redirection = cyan,bold
here-string-tri = yellow
here-string-text = 18
here-string-var = cyan,bg:18
exec-descriptor = yellow,bold
comment = 7
correct-subtle = 12
incorrect-subtle = red
subtle-separator = green
subtle-bg = bg:18
secondary =
recursive-base =
[command-point]
reserved-word = yellow
subcommand = yellow
alias = blue
suffix-alias = green
global-alias = blue,bold
builtin = blue
function = blue
command = blue
precommand = blue
hashed-command = green
single-sq-bracket = green
double-sq-bracket = green
double-paren = yellow
[paths]
path = cyan
pathseparator = cyan
path-to-dir = magenta,underline
globbing = red
globbing-ext = 13
[brackets]
paired-bracket = bg:blue
bracket-level-1 = green,bold
bracket-level-2 = yellow,bold
bracket-level-3 = cyan,bold
[arguments]
single-hyphen-option = 12
double-hyphen-option = 12
back-quoted-argument = none
single-quoted-argument = yellow
double-quoted-argument = yellow
dollar-quoted-argument = yellow
[in-string]
; backslash in $'...'
back-dollar-quoted-argument = cyan
; backslash or $... in "..."
back-or-dollar-double-quoted-argument = cyan
[other]
variable = 113
assign = green
assign-array-bracket = green
history-expansion = blue,bold
[math]
mathvar = blue,bold
mathnum = magenta
matherr = red
[for-loop]
forvar = none
fornum = magenta
; operator
foroper = yellow
; separator
forsep = yellow,bold
[case]
case-input = green
case-parentheses = yellow
case-condition = bg:blue

View File

@ -1,5 +1,5 @@
# Config and cache directory paths
ZSH_DIR="$XDG_CONFIG_HOME/zsh"
ZSH_DIR="${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}"
LOG_DIR="$XDG_DATA_HOME/logs"
HISTFILE="$XDG_DATA_HOME/zsh/history"
HISTSIZE=999999
@ -52,29 +52,29 @@ zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
zstyle ':compinstall' filename "${ZDOTDIR:-~}/.zshrc"
# Pre-load vi-mode edit-command-line before antigen plugins are loaded
autoload -z edit-command-line
zle -N edit-command-line
export WORDCHARS='*?_[]~=&;!#$%^(){}'
x-bash-backward-kill-word(){ WORDCHARS='' zle kill-word; }
zle -N x-bash-backward-kill-word
# Load antigen & plugins
ANTIGEN_LOG="$LOG_DIR/antigen-$(date -u --iso-8601=seconds | cut -d+ -f1).log"
antigen_src="$ADOTDIR/antigen.zsh"
if [ ! -f "$antigen_src" ]; then
git clone https://github.com/zsh-users/antigen.git "$ADOTDIR"
declare -A ZINIT
ZINIT[HOME_DIR]="$XDG_CACHE_HOME/zsh/zinit"
ZINIT[BIN_DIR]="${ZINIT[HOME_DIR]}/bin"
ZINIT[PLUGINS_DIR]="${ZINIT[HOME_DIR]}/plugins"
if [ ! -e "${ZINIT[HOME_DIR]}" ]; then
git clone https://github.com/zdharma/zinit.git "${ZINIT[HOME_DIR]}"
fi
source "$antigen_src"
source "${ZINIT[HOME_DIR]}"/zinit.zsh
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle mafredri/zsh-async
antigen bundle agkozak/zsh-z
zinit wait lucid light-mode for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions
antigen apply
zinit light Aloxaf/fzf-tab
zinit light agkozak/zsh-z
# Vim mode!
bindkey -v
@ -114,56 +114,14 @@ ZSH_AUTOSUGGEST_USE_ASYNC=true
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=128
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#(up|down)-line-or-history}")
default='fg=12'
prog='fg=blue'
ZSH_HIGHLIGHT_STYLES=()
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets root line)
ZSH_HIGHLIGHT_STYLES[root]='bg=red'
ZSH_HIGHLIGHT_STYLES[default]=$default
ZSH_HIGHLIGHT_STYLES[arg0]=$prog
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold'
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[alias]=$prog
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=green'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=4'
ZSH_HIGHLIGHT_STYLES[function]=$prog
ZSH_HIGHLIGHT_STYLES[command]=$prog
ZSH_HIGHLIGHT_STYLES[precommand]='fg=4'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green'
ZSH_HIGHLIGHT_STYLES[path]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[path_separator]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=208'
ZSH_HIGHLIGHT_STYLES[globbing]='fg=red'
ZSH_HIGHLIGHT_STYLES[comment]='fg=7'
ZSH_HIGHLIGHT_STYLES[history-expansion]=$default
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$default
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=$default
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[assign]='fg=green'
ZSH_HIGHLIGHT_STYLES[redirection]='fg=cyan,bold'
source "$XDG_CONFIG_HOME/aliases"
# Load some manual plugins
source "$ZSH_DIR/plugins/sudo.zsh"
source "$ZSH_DIR/plugins/fish-theme.zsh"
source "$ZSH_DIR/plugins/git-rprompt.zsh"
[ -f '/usr/share/fzf/key-bindings.zsh' ] && source /usr/share/fzf/key-bindings.zsh
[ -f '/usr/share/doc/pkgfile/command-not-found.zsh' ] && source /usr/share/doc/pkgfile/command-not-found.zsh
# Completion initialisation
autoload -U compinit bashcompinit
compinit
bashcompinit
# gopass completion
if exists gopass; then
source <(gopass completion bash)
fi
trysource() { for f in "$@"; do source "$f" 2>/dev/null && return; done; }
trysource /usr/share/fzf/key-bindings.zsh \
/usr/share/doc/fzf/examples/key-bindings.zsh
trysource /usr/share/doc/pkgfile/command-not-found.zsh # pkgfile on Arch