dotfiles/.zshrc

92 lines
3 KiB
Bash
Raw Normal View History

2024-03-27 14:57:16 +00:00
# -----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <florianbadie@odrling.xyz> wrote this file. As long as you retain this notice
# you can do whatever you want with this stuff. If we meet some day, and you
# think this stuff is worth it, you can buy me a beer in return. odrling
# -----------------------------------------------------------------------------
2022-01-08 16:45:34 +00:00
stty -ixon # Disable ctrl-s and ctrl-q.
2024-03-12 17:15:11 +00:00
# load modules
source ~/.zsh/zsh-completions/zsh-completions.plugin.zsh
# source zvm immediately
ZVM_INIT_MODE=sourcing
[ -z "$NVIM" ] && source ~/.zsh/zsh-vi-mode/zsh-vi-mode.plugin.zsh
2021-12-07 16:53:57 +00:00
2024-04-15 08:54:45 +00:00
source ~/.zsh/fzy.zsh
2021-12-07 16:53:57 +00:00
2024-03-27 13:27:43 +00:00
source ~/.zsh/envs.zsh
# osc-7 support for foot
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
}
chpwd_functions+=(chpwd-osc7-pwd)
2023-10-24 04:25:27 +00:00
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
autoload -U compinit && compinit
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
# vcs prompt info
autoload -Uz vcs_info
vcs_info_format() {
[ -n "${vcs_info_msg_0_}" ] && vcs_info_formatted=" ${vcs_info_msg_0_}" || vcs_info_formatted=""
}
zstyle ':vcs_info:*' check-for-staged-changes true
zstyle ':vcs_info:*' check-for-changes true
# Set custom strings for an unstaged vcs repo changes (*) and staged changes (+)
zstyle ':vcs_info:*' unstagedstr ' *'
zstyle ':vcs_info:*' stagedstr ' +'
# Set the format of the Git information for vcs_info
zstyle ':vcs_info:git:*' formats '(%b%u%c)'
zstyle ':vcs_info:git:*' actionformats '(%b|%a%u%c)'
precmd_functions+=(vcs_info vcs_info_format)
# prompt
[ "$GRAPHICAL_TTY" = 1 ] && shell_char=|| shell_char=$
[ -n "$SSH_CONNECTION" ] && prompt_host='%B%F{red}%n@%m%f '
setopt prompt_subst
PROMPT='${prompt_host}%F{blue}%4~%f%b%F{green}${vcs_info_formatted}%f %(?.%F{green}.%F{red})${shell_char}%f '
# set format for the time command
TIMEFMT="%J %mU user %mS system %P cpu %*E total"
# set tty for gpg-agent
export GPG_TTY="$(tty)"
2024-03-27 14:10:49 +00:00
export PINENTRY_USER_DATA="USE_CURSES=1"
odr-update-gpg-agent() {
gpg-connect-agent updatestartuptty /bye &>/dev/null
}
preexec_functions+=(odr-update-gpg-agent)
# local config
. ~/.shaliases
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
true # always succeed