2022-12-13 16:43:38 +00:00
|
|
|
typeset -U path
|
|
|
|
|
2024-07-15 23:02:58 +00:00
|
|
|
HISTFILE=${XDG_STATE_HOME:-$HOME/.local/state}/zsh/histfile
|
|
|
|
if [[ ! -d ${HISTFILE:h} ]]; then
|
|
|
|
mkdir -p ${HISTFILE:h}
|
|
|
|
fi
|
|
|
|
if [[ ! -e $HISTFILE && -e ~/.histfile ]]; then
|
|
|
|
mv ~/.histfile $HISTFILE
|
|
|
|
fi
|
2013-03-15 07:37:33 +00:00
|
|
|
HISTSIZE=100000
|
|
|
|
SAVEHIST=100000
|
2017-03-06 16:15:09 +00:00
|
|
|
unsetopt histsavenodups
|
|
|
|
|
2014-06-27 05:45:18 +00:00
|
|
|
|
2013-03-15 07:37:33 +00:00
|
|
|
setopt autocd extendedglob notify correct autonamedirs
|
|
|
|
setopt list_ambiguous autopushd pushd_ignore_dups
|
2023-09-15 16:18:32 +00:00
|
|
|
setopt hist_ignore_space share_history
|
2017-03-06 16:15:09 +00:00
|
|
|
#setopt hist_ignore_all_dups
|
2013-03-15 07:37:33 +00:00
|
|
|
setopt no_auto_remove_slash auto_param_slash
|
|
|
|
setopt completeinword
|
2023-03-02 15:21:35 +00:00
|
|
|
#setopt chase_links
|
2013-03-15 07:37:33 +00:00
|
|
|
setopt short_loops
|
|
|
|
setopt cdable_vars
|
2020-04-02 16:21:55 +00:00
|
|
|
WORDCHARS=${WORDCHARS//\/}
|
2021-12-03 14:10:31 +00:00
|
|
|
cdpath+=$HOME
|
2013-03-15 07:37:33 +00:00
|
|
|
|
2019-02-01 10:13:51 +00:00
|
|
|
export ZDOTDIR=${ZDOTDIR:-$HOME/.zsh}
|
2023-03-02 15:21:35 +00:00
|
|
|
fpath=($ZDOTDIR/functions $fpath)
|
2019-02-01 10:13:51 +00:00
|
|
|
|
2020-02-13 13:21:42 +00:00
|
|
|
function exists { command -v "$@" >/dev/null }
|
|
|
|
|
2016-07-25 11:48:52 +00:00
|
|
|
# get a file from ZDOTDIR, return file in /etc/zsh if it does not exist
|
|
|
|
zdotfile() {
|
|
|
|
if [[ -e $ZDOTDIR/$1 ]]; then
|
|
|
|
echo $ZDOTDIR/$1
|
|
|
|
else
|
|
|
|
echo /etc/zsh/$1
|
|
|
|
fi
|
|
|
|
}
|
2019-07-08 14:11:28 +00:00
|
|
|
try-source() {
|
2020-04-29 08:35:23 +00:00
|
|
|
local i=0
|
2019-07-08 14:11:28 +00:00
|
|
|
for i in "$@"; do
|
|
|
|
if [[ -e "$i" ]]; then
|
|
|
|
source $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2021-02-06 12:30:20 +00:00
|
|
|
|
|
|
|
# run hash -r after the given command. Useful for package manager commands that
|
|
|
|
# change installed packages
|
|
|
|
hashafter () {
|
|
|
|
local fname=$1
|
|
|
|
eval "
|
|
|
|
function $fname() {
|
|
|
|
command $fname \"\$@\"
|
|
|
|
hash -r
|
|
|
|
}
|
|
|
|
"
|
|
|
|
}
|
|
|
|
|
2019-07-10 13:36:41 +00:00
|
|
|
exists() { command -v "$@" >/dev/null }
|
2013-03-15 07:37:33 +00:00
|
|
|
|
2020-04-29 08:35:23 +00:00
|
|
|
function(){
|
|
|
|
try-source $(zdotfile dirs)
|
|
|
|
}
|
2019-05-14 12:45:13 +00:00
|
|
|
|
2022-12-13 16:43:38 +00:00
|
|
|
|
|
|
|
ZIM_HOME=${XDG_CACHE_HOME:-$HOME/.cache}/zim
|
|
|
|
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
|
|
|
|
curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
|
|
|
|
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
|
|
|
|
fi
|
|
|
|
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
|
|
|
|
source ${ZIM_HOME}/zimfw.zsh init -q
|
|
|
|
fi
|
|
|
|
source ${ZIM_HOME}/init.zsh
|
|
|
|
|
|
|
|
|
2023-01-13 10:38:12 +00:00
|
|
|
. $(zdotfile completion.zsh)
|
2019-07-10 13:36:41 +00:00
|
|
|
. $(zdotfile bindings.zsh)
|
2016-01-05 02:45:19 +00:00
|
|
|
|
2013-03-15 07:37:33 +00:00
|
|
|
stty -ixon
|
|
|
|
|
2020-04-29 08:35:23 +00:00
|
|
|
function(){
|
|
|
|
local i=0
|
|
|
|
for i in ${ZDOTDIR:+$ZDOTDIR/aliases/*~*.zwc(N)} /etc/zsh/aliases/*~*.zwc(N); do
|
|
|
|
. $i
|
|
|
|
done
|
|
|
|
}
|
2016-01-05 03:34:13 +00:00
|
|
|
|
2019-07-10 13:36:41 +00:00
|
|
|
if ! (grep -q 'local' <<<$PATH && grep -q 'sbin' <<<$PATH); then
|
|
|
|
. /etc/zsh/zprofile
|
|
|
|
fi
|
2013-03-15 07:37:33 +00:00
|
|
|
|
2018-05-14 13:09:22 +00:00
|
|
|
FZF_ALT_C_COMMAND="fd -t d"
|
2020-02-13 13:21:42 +00:00
|
|
|
|
|
|
|
if exists stack; then
|
|
|
|
eval "$(stack --bash-completion-script stack)"
|
|
|
|
fi
|
|
|
|
|
2020-02-13 14:17:21 +00:00
|
|
|
exists thefuck && eval $(thefuck --alias)
|
2021-07-07 19:43:09 +00:00
|
|
|
|
2021-07-24 21:12:48 +00:00
|
|
|
if [[ -e $HOME/.calendars ]]; then
|
|
|
|
_prompt_todos() {
|
|
|
|
local todos=$(rg -l '^STATUS:NEEDS-ACTION' $HOME/.calendars | wc -l)
|
|
|
|
[[ $todos -gt 0 ]] && echo "Todos: $todos"
|
|
|
|
}
|
|
|
|
__chromaz_extra_left+=_prompt_todos
|
|
|
|
fi
|
2023-03-02 15:07:52 +00:00
|
|
|
|
|
|
|
if exists mail; then
|
|
|
|
_prompt_cron_mails() {
|
2023-03-08 16:36:58 +00:00
|
|
|
[[ ! -e $MAIL ]] && return
|
2023-03-02 15:07:52 +00:00
|
|
|
local newmails=$(mail -Hf $MAIL | grep -c '^.N')
|
|
|
|
[[ $newmails -gt 0 ]] && echo "Cron Notifications: $newmails"
|
|
|
|
}
|
|
|
|
__chromaz_extra_left+=_prompt_cron_mails
|
|
|
|
fi
|
2023-09-15 16:18:32 +00:00
|
|
|
tabs -4
|