Skip to content

Commit

Permalink
update zsh config
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesChiuGit committed Aug 2, 2024
1 parent e2ce2c6 commit 983790e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion conf.d/zsh/aliases.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Core Aliases
alias sozsh='source ~/.zshenv && zsh_recompile'
alias sozsh='source ~/.zshenv && source ~/.config/zsh/.zshrc && zsh_recompile'
alias rm='rm -iv'
alias mkdir='mkdir -pv'
alias ps='ps auxf'
Expand Down
6 changes: 3 additions & 3 deletions conf.d/zsh/exports.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export GNUPGHOME="$XDG_DATA_HOME"/gnupg
export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
export CONDARC="$XDG_CONFIG_HOME"/conda/condarc
export PAGER=ov
export FZF_DEFAULT_OPTS="\
--ansi --height 40% --layout=reverse --border --separator='╸' --header='E to edit' \
--preview-label='┓ ⟪Preview⟫ ┏' --preview-window=border-bold --scrollbar '▌▐'\
Expand All @@ -48,7 +47,8 @@ export _ZO_FZF_OPTS="\

# zsh plugins options
export ANTIDOTE_HOME="$XDG_CACHE_HOME"/antidote
export ZSH_EVALCACHE_DIR="$XDG_CACHE_HOME"/zsh/zsh-evalcache
# export ZSH_EVALCACHE_DIR="$XDG_CACHE_HOME"/zsh/evalcache
export ZSH_SMARTCACHE_DIR="$XDG_CACHE_HOME"/zsh/smartcache
export ZSH_AUTOSUGGEST_USE_ASYNC="true"
export ZSH_COMPDUMP="$XDG_CACHE_HOME"/zsh/compdump

Expand Down Expand Up @@ -97,7 +97,7 @@ function set_conda_dir() {
set_conda_dir
if (( $+commands[conda] )); then
# eval "$("$__conda_dir"/bin/conda 'shell.zsh' 'hook' 2>/dev/null)"
_evalcache "$__conda_dir"/bin/conda shell.zsh hook
smartcache eval "$__conda_dir"/bin/conda shell.zsh hook
else
if [ -f "$__conda_dir/etc/profile.d/conda.sh" ]; then
# shellcheck disable=SC1091
Expand Down
19 changes: 5 additions & 14 deletions conf.d/zsh/functions.zsh
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
zsh_recompile() {
# ${ZDOTDIR} cache
rm -rf ${ZDOTDIR}/.zcompdump
for zfile in ${ZDOTDIR}/(.zshenv|.zshrc|.zcompdump); do
for zfile in ${ZDOTDIR}/(.zshenv|.zshrc); do
rm -rf ${zfile}.zwc
zcompile -UR ${zfile} && echo "${zfile}.zwc compiled!"
done
unset zfile

# ${ZSH_COMPDUMP} cache
rm -rf ${zfile}.zwc
if [[ ! ${ZSH_COMPDUMP}.zwc -nt ${ZSH_COMPDUMP} ]]; then
zcompile -UR ${ZSH_COMPDUMP} && echo "${ZSH_COMPDUMP}.zwc compiled!"
fi
# belak/zsh-utils compdump
compdump="$XDG_CACHE_HOME"/zsh/compdump
rm -rf ${compdump}
source ${ZDOTDIR}/.zshrc
rm -rf ${compdump}.zwc
zcompile -UR ${compdump} && echo "${compdump}.zwc compiled!"
unset compdump

# antidote plugins
for zfile in ${XDG_CACHE_HOME}/antidote/**/**/*.zsh; do
rm -rf ${zfile}.zwc
Expand Down Expand Up @@ -83,4 +70,8 @@ nix_reload() {
fi
}

-help() {
bat -plhelp --paging=always --color=always
}

# vim: set ft=zsh :
2 changes: 1 addition & 1 deletion conf.d/zsh/history.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
HISTSIZE="10000"
SAVEHIST="10000"

HISTFILE="$XDG_CACHE_HOME"/zsh/zsh_history
HISTFILE="$XDG_CACHE_HOME"/zsh/history
mkdir -p "$(dirname "$HISTFILE")"
6 changes: 3 additions & 3 deletions conf.d/zsh/plugins.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export _ZO_EXCLUDE_DIRS="$XDG_CACHE_HOME;$XDG_DATA_HOME;$XDG_STATE_HOME"
# eval "$(starship init zsh)"

# Use mroth/evalcache to speedup zsh loading time
_evalcache zoxide init zsh
_evalcache starship init zsh
(( $OSTYPE[(I)msys] )) && _evalcache mise activate zsh
smartcache eval zoxide init zsh
smartcache eval starship init zsh
(( $OSTYPE[(I)msys] )) && smartcache eval mise activate zsh

# belak/zsh-utils xdg config
zstyle ':zsh-utils:*:*' use-xdg-basedirs 'yes'
Expand Down
9 changes: 7 additions & 2 deletions home-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,16 @@ with lib;
"zsh-users/zsh-autosuggestions kind:defer"
"zsh-users/zsh-completions kind:fpath"
"belak/zsh-utils path:completion"
"zdharma-continuum/fast-syntax-highlighting kind:defer" # add before zsh-history-substring-search to prevent breaking
"zsh-users/zsh-history-substring-search kind:defer"
"zdharma-continuum/fast-syntax-highlighting kind:defer"
"MichaelAquilina/zsh-you-should-use kind:defer"
"hlissner/zsh-autopair"
"mroth/evalcache"
"QuarticCat/zsh-smartcache" # better mroth/evalcache
"unixorn/docker-helpers.zshplugin kind:defer"
"zpm-zsh/colorize kind:defer" # Colorize the output of various programs
"zpm-zsh/colors" # Enhanced colors for zsh
"MichaelAquilina/zsh-autoswitch-virtualenv kind:defer" # Auto-switch python venv, pipenv, poetry
"Freed-Wu/zsh-help" # colorize `XXX --help`
# oh-my-zsh plugins
"getantidote/use-omz" # handle OMZ dependencies
"ohmyzsh/ohmyzsh path:lib" # load OMZ's library
Expand Down

0 comments on commit 983790e

Please sign in to comment.