dotfiles/.zshrc

86 lines
2.8 KiB
Bash
Raw Normal View History

2022-01-08 16:45:34 +00:00
stty -ixon # Disable ctrl-s and ctrl-q.
2024-03-12 17:15:11 +00:00
source ~/.zsh/envs.zsh
export GPG_TTY="$(tty)"
2024-03-12 17:15:11 +00:00
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.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
2024-03-01 18:29:00 +00:00
source ~/.p10k.zsh
source ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme
# load modules
source ~/.zsh/zsh-completions/zsh-completions.plugin.zsh
2023-12-12 23:10:10 +00:00
# fixes conflict with fzf key-bindings
# Do the initialization when the script is sourced (i.e. Initialize instantly)
ZVM_INIT_MODE=sourcing
# Disable the cursor style feature
ZVM_CURSOR_STYLE_ENABLED=false
[ -z "$NVIM" ] && source ~/.zsh/zsh-vi-mode/zsh-vi-mode.plugin.zsh
2021-12-07 16:53:57 +00:00
odr-update-gpg-agent() {
gpg-connect-agent updatestartuptty /bye &>/dev/null
}
preexec_functions+=(odr-update-gpg-agent)
if command -v fzf >/dev/null; then
source ~/.bash/fzf/shell/completion.zsh
source ~/.bash/fzf/shell/key-bindings.zsh
source ~/.bash/fzf-tab-completion/zsh/fzf-zsh-completion.sh
export FZF_COMPLETION_TRIGGER=''
bindkey '^T' fzf-completion
bindkey '^I' $fzf_default_completion
fi
2021-12-07 16:53:57 +00:00
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
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
2021-12-07 16:53:57 +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