2018-11-10 14:55:37 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
2019-08-27 09:07:51 +00:00
|
|
|
ZSH_CACHE_DIR="$HOME/.cache/dotfiles"
|
|
|
|
if [[ ! -d "$ZSH_CACHE_DIR" ]]; then
|
|
|
|
mkdir -pv "$ZSH_CACHE_DIR"
|
|
|
|
fi
|
|
|
|
|
2019-06-27 11:14:18 +00:00
|
|
|
source "$ZSH_DOTFILES/zplg.zsh"
|
|
|
|
|
2019-10-25 17:50:15 +00:00
|
|
|
_plugin() {
|
|
|
|
_perf_timer_start "plugin $1"
|
|
|
|
plugin "$@"
|
|
|
|
_perf_timer_stop "plugin $1"
|
|
|
|
}
|
|
|
|
|
2019-12-30 15:22:28 +00:00
|
|
|
_checkout_latest_version='build=plugin-cfg-git-checkout-version "*"'
|
|
|
|
|
|
|
|
_plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version"
|
2019-06-27 11:14:18 +00:00
|
|
|
|
2019-08-26 19:48:48 +00:00
|
|
|
# compinit {{{
|
|
|
|
# note that completion system must be initialized after zsh-completions and
|
2019-12-21 19:19:24 +00:00
|
|
|
# before Oh My Zsh
|
2019-09-24 19:34:15 +00:00
|
|
|
autoload -U compinit
|
|
|
|
|
|
|
|
run_compdump=1
|
|
|
|
# glob qualifiers description:
|
|
|
|
# N turn on NULL_GLOB for this expansion
|
|
|
|
# . match only plain files
|
|
|
|
# m-1 check if the file was modified today
|
|
|
|
# see "Filename Generation" in zshexpn(1)
|
|
|
|
for match in $HOME/.zcompdump(N.m-1); do
|
|
|
|
run_compdump=0
|
|
|
|
break
|
|
|
|
done; unset match
|
|
|
|
|
|
|
|
if (( $run_compdump )); then
|
|
|
|
echo "$0: rebuilding zsh completion dump"
|
|
|
|
# -D flag turns off compdump loading
|
|
|
|
compinit -D
|
|
|
|
compdump
|
|
|
|
else
|
|
|
|
# -C flag disables some checks performed by compinit - they are not needed
|
|
|
|
# because we already have a fresh compdump
|
|
|
|
compinit -C
|
|
|
|
fi
|
|
|
|
unset run_compdump
|
2019-08-26 19:48:48 +00:00
|
|
|
# }}}
|
2019-06-27 11:14:18 +00:00
|
|
|
|
2019-12-21 19:19:24 +00:00
|
|
|
# Oh My Zsh {{{
|
2019-06-27 11:14:18 +00:00
|
|
|
|
2019-09-24 19:34:15 +00:00
|
|
|
omz_features=(key-bindings termsupport)
|
2019-06-27 11:14:18 +00:00
|
|
|
omz_plugins=(git extract fasd)
|
|
|
|
|
2019-12-21 19:19:24 +00:00
|
|
|
_plugin ohmyzsh 'ohmyzsh/ohmyzsh' \
|
2019-09-24 19:34:15 +00:00
|
|
|
load='lib/'${^omz_features}'.zsh' \
|
|
|
|
load='plugins/'${^omz_plugins}'/*.plugin.zsh' \
|
2019-06-27 11:14:18 +00:00
|
|
|
before_load='ZSH="$plugin_dir"' \
|
|
|
|
after_load='plugin-cfg-path fpath prepend completions functions' \
|
|
|
|
after_load='plugin-cfg-path fpath prepend plugins/'${^omz_plugins}
|
|
|
|
|
|
|
|
unset omz_plugins
|
|
|
|
|
|
|
|
# }}}
|
2018-11-10 14:55:37 +00:00
|
|
|
|
2021-01-08 16:26:24 +00:00
|
|
|
# fasd {{{
|
|
|
|
|
2021-01-17 11:07:31 +00:00
|
|
|
#unalias j
|
|
|
|
#j() {
|
|
|
|
# local _fasd_ret
|
|
|
|
# _fasd_ret="$(
|
|
|
|
# # -l: list all paths in the database (without scores)
|
|
|
|
# # -d: list only directories
|
|
|
|
# # -R: in the reverse order
|
|
|
|
# fasd -l -d -R |
|
|
|
|
# fzf --height=40% --layout=reverse --tiebreak=index --query="$*"
|
|
|
|
# )"
|
|
|
|
# if [[ -d "$_fasd_ret" ]]; then
|
|
|
|
# cd -- "$_fasd_ret"
|
|
|
|
# elif [[ -n "$_fasd_ret" ]]; then
|
|
|
|
# print -- "$_fasd_ret"
|
|
|
|
# fi
|
|
|
|
#}
|
2021-01-08 16:26:24 +00:00
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
2020-07-25 17:32:58 +00:00
|
|
|
# _plugin fzf 'junegunn/fzf' "$_checkout_latest_version" \
|
|
|
|
# build='./install --bin' \
|
|
|
|
# after_load='plugin-cfg-path path prepend bin' \
|
|
|
|
# after_load='plugin-cfg-path manpath prepend man'
|
2018-11-10 14:55:37 +00:00
|
|
|
|
2019-12-30 15:22:28 +00:00
|
|
|
if command_exists python; then
|
|
|
|
_plugin alias-tips 'djui/alias-tips'
|
|
|
|
fi
|
2018-11-10 14:55:37 +00:00
|
|
|
|
2019-06-27 11:14:18 +00:00
|
|
|
FAST_WORK_DIR="$ZSH_CACHE_DIR"
|
2019-09-08 12:48:00 +00:00
|
|
|
if [[ "$TERM" != "linux" ]]; then
|
2019-12-30 15:22:28 +00:00
|
|
|
_plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' "$_checkout_latest_version"
|
2019-09-24 19:34:15 +00:00
|
|
|
set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; }
|
2021-01-03 17:27:52 +00:00
|
|
|
if [[ "$FAST_THEME_NAME" != "my-syntax-theme" && -z "$DOTFILES_DISABLE_MY_SYNTAX_THEME" ]]; then
|
2021-01-03 17:24:18 +00:00
|
|
|
set-my-syntax-theme
|
|
|
|
fi
|
2019-09-08 12:48:00 +00:00
|
|
|
fi
|
2019-12-30 15:22:28 +00:00
|
|
|
|
|
|
|
unset _checkout_latest_version
|