2022-01-08 16:45:34 +00:00
|
|
|
stty -ixon # Disable ctrl-s and ctrl-q.
|
|
|
|
|
2022-09-06 16:55:22 +00:00
|
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
|
|
|
mkdir -p "$(dirname $ZINIT_HOME)"
|
|
|
|
[ -f "$ZINIT_HOME/zinit.zsh" ] || git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
|
|
|
2022-09-07 01:09:41 +00:00
|
|
|
# fixes conflict with zsh-autosuggestions
|
|
|
|
# Do the initialization when the script is sourced (i.e. Initialize instantly)
|
|
|
|
ZVM_INIT_MODE=sourcing
|
2022-09-07 01:13:10 +00:00
|
|
|
# avoid showing a syntax highlighting mess
|
|
|
|
ZVM_VI_INS_LEGACY_UNDO=1
|
2022-09-07 01:09:41 +00:00
|
|
|
|
2021-12-07 16:53:57 +00:00
|
|
|
autoload -Uz _zinit
|
|
|
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
|
|
|
|
2019-01-11 18:13:34 +00:00
|
|
|
# load modules
|
2021-12-07 16:53:57 +00:00
|
|
|
zinit light zsh-users/zsh-completions
|
|
|
|
zinit light zsh-users/zsh-autosuggestions
|
2022-09-13 16:19:43 +00:00
|
|
|
[ -z "$NVIM" ] && (zinit ice wait ""; zinit light jeffreytse/zsh-vi-mode)
|
2021-12-07 16:53:57 +00:00
|
|
|
|
2023-11-27 19:07:18 +00:00
|
|
|
zinit ice has'nix-shell' wait"1" lucid; zinit light chisui/zsh-nix-shell
|
2021-12-07 16:53:57 +00:00
|
|
|
|
2023-11-27 18:53:41 +00:00
|
|
|
zinit ice has'fzf' wait lucid; zinit snippet ~/.bash/fzf/shell/completion.zsh
|
|
|
|
zinit ice has'fzf' wait lucid; zinit snippet ~/.bash/fzf/shell/key-bindings.zsh
|
2021-12-07 16:53:57 +00:00
|
|
|
|
2023-11-27 18:52:51 +00:00
|
|
|
zinit ice has'fzf' wait lucid; zinit snippet ~/.bash/fzf-tab-completion/zsh/fzf-zsh-completion.sh
|
2023-11-27 18:45:37 +00:00
|
|
|
command -v direnv 2>&1 > /dev/null && source <(direnv hook zsh)
|
|
|
|
|
2022-09-13 16:34:01 +00:00
|
|
|
if command -v starship 2>&1 > /dev/null; then
|
|
|
|
source <(starship init zsh --print-full-init)
|
2022-09-13 17:07:00 +00:00
|
|
|
else
|
|
|
|
autoload -Uz promptinit
|
|
|
|
promptinit; prompt gentoo
|
2022-09-13 16:34:01 +00:00
|
|
|
fi
|
|
|
|
|
2023-10-24 04:25:27 +00:00
|
|
|
function osc7-pwd() {
|
|
|
|
emulate -L zsh # also sets localoptions for us
|
|
|
|
setopt extendedglob
|
|
|
|
local LC_ALL=C
|
|
|
|
printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}}
|
|
|
|
}
|
|
|
|
|
|
|
|
function chpwd-osc7-pwd() {
|
|
|
|
(( ZSH_SUBSHELL )) || osc7-pwd
|
|
|
|
}
|
|
|
|
add-zsh-hook -Uz chpwd chpwd-osc7-pwd
|
|
|
|
|
2022-02-06 16:59:45 +00:00
|
|
|
# completion settings
|
2018-02-01 22:34:24 +00:00
|
|
|
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
|
|
|
|
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**'
|
|
|
|
zstyle ':completion:*' max-errors 2
|
|
|
|
zstyle ':completion:*' menu select=1
|
2019-06-26 21:59:48 +00:00
|
|
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle :compinstall filename "${HOME}/.zshrc" zstyle ':completion:*' rehash true
|
2022-02-06 16:39:29 +00:00
|
|
|
zstyle ':completion::complete:*' use-cache 1
|
2018-02-01 22:34:24 +00:00
|
|
|
|
2022-02-06 16:59:45 +00:00
|
|
|
# root commands completion for sudo/doas
|
2018-05-19 17:39:06 +00:00
|
|
|
[[ $UID -eq 0 ]] || () {
|
|
|
|
local i
|
|
|
|
local -T SUDO_PATH sudo_path
|
|
|
|
local -U sudo_path
|
|
|
|
sudo_path=($path {,/usr{,/local}}/sbin(N-/))
|
2019-06-26 22:10:41 +00:00
|
|
|
for i in sudo{,x} su{,x} doas{,x}
|
2018-05-19 17:39:06 +00:00
|
|
|
do zstyle ":completion:*:$i:*" environ PATH="$SUDO_PATH"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-02-06 16:59:45 +00:00
|
|
|
# history file settings
|
2019-08-25 09:49:08 +00:00
|
|
|
export HISTFILE=~/.histfile
|
2022-01-17 17:11:09 +00:00
|
|
|
export HISTSIZE=100000
|
|
|
|
export SAVEHIST=100000
|
2022-09-23 14:49:32 +00:00
|
|
|
setopt appendhistory notify histexpiredupsfirst histsavenodups \
|
|
|
|
incappendhistorytime histnostore histignorespace share_history
|
2022-02-06 16:59:45 +00:00
|
|
|
|
2018-02-01 22:34:24 +00:00
|
|
|
unsetopt beep
|
|
|
|
|
2023-11-27 17:42:25 +00:00
|
|
|
. ~/.shaliases
|
2022-10-13 23:20:26 +00:00
|
|
|
|
2018-12-31 14:43:18 +00:00
|
|
|
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
|
2021-12-07 16:53:57 +00:00
|
|
|
|
2022-10-07 14:20:18 +00:00
|
|
|
fpath+=~/.zfunc
|
|
|
|
|
2023-12-12 22:25:25 +00:00
|
|
|
autoload -U compinit && compinit
|
2021-12-07 16:53:57 +00:00
|
|
|
autoload -U +X bashcompinit && bashcompinit && complete -o bashdefault -o default -o nospace -C qpdf qpdf
|
|
|
|
|
|
|
|
zinit cdreplay -q
|