Files
dotfiles/zsh/dot-zshrc
2025-12-03 21:32:20 +01:00

154 lines
4.0 KiB
Plaintext

# Path to your oh-my-zsh installation.
export DOTFILES=${DOTFILES:-"$HOME/.dotfiles"}
export ZSH="$DOTFILES/zsh/ohmyzsh"
export ZSH_CUSTOM="$DOTFILES/zsh/custom"
ZSH_THEME="agnoster_dx"
zstyle ':omz:update' mode reminder # just remind me to update when it's time
# zstyle ':omz:update' frequency 13
# CASE_SENSITIVE="true"
# HYPHEN_INSENSITIVE="true"
# DISABLE_MAGIC_FUNCTIONS="true"
# DISABLE_AUTO_TITLE="true"
# ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
ZSH_DISABLE_COMPFIX="true"
plugins=(
git
zsh-autosuggestions
# Disabled because the highlighting conflicts with autosuggestions
# history-substring-search
vi-mode
colored-man-pages
command-not-found
zsh-autopair
fast-syntax-highlighting
)
bindkey -M vicmd "k" up-line-or-beginning-search
bindkey -M vicmd "j" down-line-or-beginning-search
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="fg=yellow"
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND="fg=red"
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT=3
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
VI_MODE_SET_CURSOR=true
# Might cause issues?
KEYTIMEOUT=1
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
autoload -U compinit && compinit
source "$ZSH/oh-my-zsh.sh"
less_termcap[so]="${fg_bold[black]}${bg[white]}"
export LESS="-F -R -i --incsearch -M"
export PATH="${HOME}/.local/bin:${HOME}/.cargo/bin:$PATH"
export EDITOR=nvim
# export GREP_COLORS="mt=01;32"
alias cl="clear"
if (( $+commands[bat] )); then
export BAT_THEME="gruvbox-dark"
alias cat=bat
fi
if (( $+commands[devcontainer] )); then
dc() {
ORIG_DIR="$PWD"
while [[ "$PWD" != / ]] ; do
if find "$PWD"/ -maxdepth 1 -type d -name ".devcontainer" | grep -q ".devcontainer"; then
WORKSPACE_FOLDER="$PWD"
builtin cd "$ORIG_DIR"
if [[ "$1" == "nvim" ]]; then
tmux set-option -pt 0 @pane-is-vim 1
devcontainer exec --workspace-folder "$WORKSPACE_FOLDER" bash -c "$@"
tmux set-option -pt 0 @pane-is-vim 0
else
devcontainer exec --workspace-folder "$WORKSPACE_FOLDER" $@
fi
return 0
else
builtin cd ..
fi
done
builtin cd "$ORIG_DIR"
echo "Unable to find workspace folder"
return 1
}
fi
export PNPM_HOME="/home/tim/.local/share/pnpm"
if [ -d "$PNPM_HOME" ]; then
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
else
unset PNPM_HOME
fi
export FZF_DEFAULT_OPTS='--tmux'
export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
--color=fg:-1,fg+:#83a598,bg:-1,bg+:#262626
--color=hl:bold:#8ec07c,hl+:#8ec07c,marker:#cc241d
--color=prompt:#fb4934,spinner:#af5fff,pointer:#83a598,header:#87afaf
--color=border:#7c6f64,label:#7c6f64
--border="sharp" --border-label-pos="0" --preview-window="border-sharp"
--prompt="> " --marker="◆" --pointer=">" --separator="─"
--scrollbar="│" --info="right"'
if (( $+commands[fd] )); then
export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
if (( $+commands[fzf] )); then
source <(fzf --zsh)
if (( $+commands[paru] )); then
function pi {
paru -Slq | fzf -q "$1" --border-label=" Install package " --multi --preview 'paru -Si {1} --color=always' | xargs -ro paru -S
}
fi
fi
export _ZO_FZF_OPTS="--tmux"
if (( $+commands[zoxide] )); then
eval "$(zoxide init zsh --cmd cd)"
fi
# Generate missing text objects
autoload -Uz select-bracketed select-quoted
zle -N select-quoted
zle -N select-bracketed
for km in viopp visual; do
bindkey -M $km -- '-' vi-up-line-or-history
for c in {a,i}${(s..)^:-\'\"\`\|,./:;=+@}; do
bindkey -M $km $c select-quoted
done
for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do
bindkey -M $km $c select-bracketed
done
done
ZSH_TMUX_AUTOSTART=true
if (( $+commands[tmux] )); then
if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" && -z "$ZED_TERM" ]]; then
if (( $+commands[sesh] )) && (( $+commands[sesh-select] )); then
sesh-select
else
tmux new-session
fi
exit
fi
fi