Files
dotfiles/zsh/.zshrc
2025-01-08 09:49:46 +01:00

99 lines
3.0 KiB
Bash

export PATH="$HOME/.local/bin:$PATH"
[[ -z $SSH_AUTH_SOCK ]] || export FORWARD_SOCK=$SSH_AUTH_SOCK
[[ -f ~/.zsh/.powerline_config ]] && source ~/.zsh/.powerline_config
[[ -f ~/.zsh/.user_config ]] && source ~/.zsh/.user_config
[[ -f ~/.zsh/.virtual_env_config.zsh ]] && source ~/.zsh/.virtual_env_config.zsh
[[ -f ~/.zsh/.local_config ]] && source ~/.zsh/.local_config
[[ -f ~/.zsh/.os_config.zsh ]] && source ~/.zsh/.os_config.zsh
if [[ -f ~/.zsh/.shared_config ]] && [[ "$SUDO_USER" != "fabian" ]] ; then
shared_config=1
else
shared_config=0
fi
# Load Antidote
mkdir -p ${ZDOTDIR:-~}/.cache/zsh
static_file=${ZDOTDIR:-~}/.cache/zsh/.zsh_plugins.zsh
if [ $shared_config -eq 0 ]; then
plugins_txt=${ZDOTDIR:-~}/.zsh/.zsh_plugins.txt
# Vi mode
bindkey -v
VI_MODE_SET_CURSOR=true
else
plugins_txt=${ZDOTDIR:-~}/.zsh/.zsh_plugins_shared.txt
fi
# clone antidote if necessary
if ! [[ -e ${ZDOTDIR:-~}/.antidote ]]; then
git clone https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote
fi
#zstyle ':omz:plugins:docker' legacy-completion yes
zstyle ':completion:*:ssh:*' hosts off
# source antidote and load plugins from `${ZDOTDIR:-~}/.zsh_plugins.txt`
source ${ZDOTDIR:-~}/.antidote/antidote.zsh
antidote load ${plugins_txt} ${static_file}
export SSH_REAL_SOCK=$SSH_AUTH_SOCK
[[ -z $FORWARD_SOCK ]] || export SSH_AUTH_SOCK=$FORWARD_SOCK
setopt interactivecomments
setopt HIST_IGNORE_SPACE
# Clear screen by ctrl+q
bindkey '^q' clear-screen
alias vim=nvim
alias sudo='sudo '
alias cgrep="grep --color=always"
export EDITOR='nvim'
# Allow access to all libvirt vms
export LIBVIRT_DEFAULT_URI="qemu:///system"
alias ls="ls --color=always"
delzip() {
unzip -Z -1 "$@" | xargs -I{} rm -rf {}
}
# mitmproxy
export MITMPROXY_SSLKEYLOGFILE="~/.mitmproxy/sslkeylogfile.txt"
[[ -f ~/.zsh/.mac_config ]] && source ~/.zsh/.mac_config
# Workaround for async issues https://github.com/romkatv/powerlevel10k/issues/1554
unset ZSH_AUTOSUGGEST_USE_ASYNC
# Powerlevel 10k
# Remove padding on right side
ZLE_RPROMPT_INDENT=0
# To customize prompt, run `p10k configure` or edit ~/dotfiles/zsh/.p10k.zsh.
function load_p10k() {
if zmodload zsh/terminfo && (( terminfo[colors] >= 256 )) && [ $shared_config -eq 0 ]; then
[[ ! -f ~/dotfiles/zsh/.p10k.zsh ]] || source ~/dotfiles/zsh/.p10k.zsh
else
[[ ! -f ~/dotfiles/zsh/.p10k_shared.zsh ]] || source ~/dotfiles/zsh/.p10k_shared.zsh
fi
}
load_p10k
#
# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
# https://github.com/zsh-users/zsh-autosuggestions/issues/351
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export TIME_STYLE="long-iso"