2024-10-21 08:50:44 -05:00
|
|
|
system_type=$(uname -s)
|
|
|
|
|
2024-10-29 22:57:09 -05:00
|
|
|
# Shell options
|
|
|
|
OPTIONS=(
|
|
|
|
auto_cd
|
|
|
|
append_history
|
|
|
|
share_history
|
|
|
|
histignorealldups
|
2024-11-23 09:46:43 -06:00
|
|
|
INC_APPEND_HISTORY
|
2024-10-29 22:57:09 -05:00
|
|
|
|
|
|
|
## Gonna slowly turn these on and see what I like
|
2024-10-29 17:03:47 -05:00
|
|
|
|
2024-10-29 22:57:09 -05:00
|
|
|
# auto_list
|
|
|
|
# auto_menu
|
|
|
|
# auto_pushd
|
|
|
|
# completeinword
|
|
|
|
# correct
|
|
|
|
# extended_history
|
|
|
|
# histexpiredupsfirst
|
|
|
|
# histignoredups
|
|
|
|
# histignorespace
|
|
|
|
# histverify # this one can get annoying...
|
|
|
|
# interactivecomments
|
|
|
|
# listpacked
|
|
|
|
# longlistjobs
|
|
|
|
# nocaseglob
|
|
|
|
# noflowcontrol
|
|
|
|
# promptsubst
|
|
|
|
# pushdignoredups
|
|
|
|
# pushdminus
|
|
|
|
)
|
2024-10-21 08:50:44 -05:00
|
|
|
|
2024-10-29 22:57:09 -05:00
|
|
|
setopt $OPTIONS[@]
|
2024-10-21 08:50:44 -05:00
|
|
|
|
2024-10-29 22:57:09 -05:00
|
|
|
fpath+=($HOME/.config/zsh/functions)
|
2024-10-29 17:03:47 -05:00
|
|
|
|
2024-10-30 09:37:25 -05:00
|
|
|
CONFIG_DIR=$HOME/.config
|
|
|
|
ZSH_CONFIG_DIR=$CONFIG_DIR/zsh
|
|
|
|
|
2024-11-23 09:59:47 -06:00
|
|
|
FILES_TO_SOURCE=()
|
|
|
|
FILES_TO_SOURCE+=(
|
2024-10-30 09:37:25 -05:00
|
|
|
$ZSH_CONFIG_DIR/aliases
|
|
|
|
$ZSH_CONFIG_DIR/environment
|
|
|
|
$ZSH_CONFIG_DIR/zsh-unplugged # extremely minimal "package manager"
|
2024-10-29 22:57:09 -05:00
|
|
|
$HOME/.iterm2_shell_integration.zsh
|
|
|
|
)
|
|
|
|
|
2024-11-23 09:59:47 -06:00
|
|
|
if [ "$system_type" = "Darwin" ]; then
|
|
|
|
FILES_TO_SOURCE+=(
|
|
|
|
$HOMEBREW_PREFIX/opt/nvm/nvm.sh
|
|
|
|
$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2024-10-29 22:57:09 -05:00
|
|
|
for file in "${FILES_TO_SOURCE[@]}"; do
|
|
|
|
if [ -s $file ]; then
|
|
|
|
source "$file"
|
|
|
|
else
|
|
|
|
echo "WARNING: $file is empty or does not exist."
|
|
|
|
fi
|
|
|
|
done
|
2024-10-17 17:28:50 -05:00
|
|
|
|
2024-10-29 17:03:47 -05:00
|
|
|
# Load functions
|
2024-10-30 09:37:25 -05:00
|
|
|
fpath+=("$ZSH_CONFIG_DIR/functions")
|
2024-10-29 22:57:09 -05:00
|
|
|
|
2024-11-23 09:59:47 -06:00
|
|
|
FUNCS_TO_AUTOLOAD=()
|
|
|
|
FUNCS_TO_AUTOLOAD+=(
|
2024-10-29 22:57:09 -05:00
|
|
|
f
|
|
|
|
fshow
|
|
|
|
show-fpath
|
|
|
|
take
|
|
|
|
tre
|
|
|
|
touchp
|
|
|
|
unbuff
|
|
|
|
promptinit
|
|
|
|
compinit
|
|
|
|
)
|
2024-11-23 09:59:47 -06:00
|
|
|
|
|
|
|
if [ "$system_type" = "Darwin" ]; then
|
|
|
|
FUNCS_TO_AUTOLOAD+=(
|
|
|
|
brew-visit
|
2024-12-02 13:48:19 -06:00
|
|
|
ql
|
2024-11-23 09:59:47 -06:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2024-10-29 22:57:09 -05:00
|
|
|
autoload -Uz $FUNCS_TO_AUTOLOAD && compinit && promptinit
|
|
|
|
prompt pure
|
2024-10-17 17:28:50 -05:00
|
|
|
|
2024-10-29 17:03:47 -05:00
|
|
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh && source <(fzf --zsh)
|
2024-10-29 22:57:09 -05:00
|
|
|
|
|
|
|
if [ "$system_type" = "Darwin" ]; then
|
2024-10-30 09:27:56 -05:00
|
|
|
[ -f $HOME/.config/op/plugins.sh ] && source ~/.config/op/plugins.sh
|
|
|
|
[ -e $HOME/.iterm2_shell_integration.zsh ] && source $HOME/.iterm2_shell_integration.zsh
|
2024-10-29 22:57:09 -05:00
|
|
|
[ -f /opt/homebrew/opt/git-extras/share/git-extras/git-extras-completion.zsh ] && source /opt/homebrew/opt/git-extras/share/git-extras/git-extras-completion.zsh
|
2024-12-03 08:09:00 -06:00
|
|
|
if [ -d /Applications/ShellHistory.app/Contents/Helpers ]; then
|
|
|
|
# adding shhist to PATH, so we can use it from Terminal
|
|
|
|
export PATH="${PATH}:/Applications/ShellHistory.app/Contents/Helpers"
|
|
|
|
|
|
|
|
# creating an unique session id for each terminal session
|
|
|
|
__shhist_session="${RANDOM}"
|
|
|
|
|
|
|
|
# prompt function to record the history
|
|
|
|
__shhist_prompt() {
|
|
|
|
local __exit_code="${?:-1}"
|
|
|
|
\history -D -t "%s" -1 | sudo --preserve-env --user ${SUDO_USER:-${LOGNAME}} shhist insert --session ${TERM_SESSION_ID:-${__shhist_session}} --username ${LOGNAME} --hostname $(hostname) --exit-code ${__exit_code} --shell zsh
|
|
|
|
return ${__exit_code}
|
|
|
|
}
|
|
|
|
|
|
|
|
# integrating prompt function in prompt
|
|
|
|
precmd_functions=(__shhist_prompt $precmd_functions)
|
|
|
|
fi
|
2024-10-29 22:57:09 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
$HOME/.iterm2/it2check
|
|
|
|
export TERMINAL_IS_ITERM2=$?
|
|
|
|
if [ $TERMINAL_IS_ITERM2 -eq 0 ]; then
|
2024-10-21 08:50:44 -05:00
|
|
|
iterm2_print_user_vars() {
|
|
|
|
it2git
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval "$(zoxide init --cmd j zsh)"
|
2024-10-30 11:48:59 -05:00
|
|
|
[[ "$(command -v thefuck)" ]] && eval $(thefuck --alias)
|
2024-12-02 20:28:36 +00:00
|
|
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|