dotfiles/config/zsh/.zshrc

89 lines
2.4 KiB
Bash
Raw Normal View History

2024-10-15 00:44:53 +02:00
# shellcheck disable=SC1091,SC1094,SC2206,SC2148
# macOS specific
2024-06-19 23:32:59 +02:00
if [[ $(uname -s) = "Darwin" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
2023-10-20 14:34:48 +02:00
2023-04-28 02:11:31 +02:00
# prepare directories
2024-10-15 00:44:53 +02:00
mkdir -p "${XDG_CACHE_HOME}/zsh"
mkdir -p "${XDG_DATA_HOME}/zsh"
2023-04-28 02:11:31 +02:00
2024-12-27 12:45:41 +01:00
# history settings
2024-12-27 01:15:02 +01:00
export HISTFILE="${XDG_DATA_HOME}/zsh/history"
2024-12-27 12:45:41 +01:00
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
2021-05-11 14:24:48 +02:00
setopt HIST_IGNORE_ALL_DUPS
2024-12-27 12:45:41 +01:00
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
2021-05-11 14:24:48 +02:00
setopt HIST_REDUCE_BLANKS
2024-12-27 12:45:41 +01:00
setopt HIST_SAVE_NO_DUPS
2022-07-23 17:29:49 +02:00
setopt INC_APPEND_HISTORY
2024-12-27 12:45:41 +01:00
setopt SHARE_HISTORY
rm -rf "${ZDOTDIR}/.zsh_history" && ln -sf "${XDG_DATA_HOME}/zsh/history" "${ZDOTDIR}/.zsh_history"
2021-05-11 14:24:48 +02:00
2023-07-19 15:11:07 +02:00
# set path
2024-08-13 00:51:06 +02:00
path=(~/.local/bin "${path[@]}")
2023-04-28 02:11:31 +02:00
# source configuration
2024-10-15 00:44:53 +02:00
source "${ZDOTDIR}/aliases.zsh"
source "${ZDOTDIR}/keys.zsh"
source "${ZDOTDIR}/fzf.zsh"
2024-12-27 01:15:02 +01:00
## it has to be last
source "${ZDOTDIR}/atuin.zsh"
2021-09-06 12:37:22 +02:00
2023-07-19 15:11:07 +02:00
# set fpath
2024-08-13 12:20:43 +02:00
fpath=(~/.local/git/zsh_modules/wd $fpath)
2022-03-30 11:58:54 +02:00
2023-04-28 02:11:31 +02:00
# theme and colors
2023-05-03 01:34:27 +02:00
if [[ $(command -v vivid) ]]; then
2024-10-15 00:44:53 +02:00
LS_COLORS=$(vivid generate molokai)
export LS_COLORS
2023-05-03 01:34:27 +02:00
else
unset LS_COLORS
fi
2024-11-02 23:23:27 +01:00
source ~/.local/git/zsh_modules/powerlevel10k/powerlevel10k.zsh-theme
2025-01-07 18:09:53 +01:00
source "${ZDOTDIR}/p10k.zsh"
2024-11-02 23:23:27 +01:00
if [[ -r "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh"
2024-06-24 15:20:23 +02:00
fi
2023-04-28 02:11:31 +02:00
# completion
autoload -Uz compinit
2024-10-15 00:44:53 +02:00
if [ ! -e "${XDG_DATA_HOME}/zsh/zcompdump.zwc" ]; then
2023-05-03 01:34:27 +02:00
autoload -Uz zrecompile
2024-10-15 00:44:53 +02:00
zrecompile -p -R "${XDG_DATA_HOME}/zsh/zcompdump"
2023-05-03 01:34:27 +02:00
fi
2024-10-15 00:44:53 +02:00
compinit -C -d "${XDG_DATA_HOME}/zsh/zcompdump"
zstyle ':completion:*' menu no
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
zstyle ':fzf-tab:complete:cd:*' popup-pad 60 0
zstyle ':fzf-tab:complete:diff:*' popup-min-size 80 12
# source modules
source "${HOME}/.local/git/zsh_modules/fzf-tab/fzf-tab.plugin.zsh"
source "${HOME}/.local/git/zsh_modules/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"
source "${HOME}/.local/git/zsh_modules/wd/wd.plugin.zsh"
export WD_CONFIG="${XDG_CONFIG_HOME}/wd_list"
# quick note functionality
2024-10-15 00:44:53 +02:00
if [[ -f "${HOME}/.note" ]]; then
2022-04-12 17:48:35 +02:00
echo
2024-10-15 00:44:53 +02:00
cat "${HOME}/.note"
2022-04-12 17:48:35 +02:00
echo
fi
2024-12-12 01:15:51 +01:00
# cleaning
rm -rf "${HOME}/.warprc"
# local settings
2024-10-15 00:44:53 +02:00
if [[ -f "${HOME}/.local/config/zsh" ]]; then
source "${HOME}/.local/config/zsh"
2023-05-03 01:34:27 +02:00
fi