mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] inline the fasd plugin from OMZ and remove the useless one called 'extract'
This commit is contained in:
parent
b467ed4d63
commit
aecef017f9
1 changed files with 29 additions and 16 deletions
|
@ -49,7 +49,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version"
|
||||||
# Oh My Zsh {{{
|
# Oh My Zsh {{{
|
||||||
|
|
||||||
omz_features=(key-bindings termsupport)
|
omz_features=(key-bindings termsupport)
|
||||||
omz_plugins=(git extract fasd)
|
omz_plugins=(git)
|
||||||
|
|
||||||
_plugin ohmyzsh 'ohmyzsh/ohmyzsh' \
|
_plugin ohmyzsh 'ohmyzsh/ohmyzsh' \
|
||||||
load='lib/'${^omz_features}'.zsh' \
|
load='lib/'${^omz_features}'.zsh' \
|
||||||
|
@ -64,22 +64,35 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version"
|
||||||
|
|
||||||
# fasd {{{
|
# fasd {{{
|
||||||
|
|
||||||
unalias j
|
if command_exists fasd; then
|
||||||
j() {
|
# Initialization taken from <https://github.com/ohmyzsh/ohmyzsh/blob/6fbad5bf72fad4ecf30ba4d4ffee62bac582f0ed/plugins/fasd/fasd.plugin.zsh>
|
||||||
local _fasd_ret
|
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
|
||||||
_fasd_ret="$(
|
if [[ "${commands[fasd]}" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then
|
||||||
# -l: list all paths in the database (without scores)
|
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
|
||||||
# -d: list only directories
|
fi
|
||||||
# -R: in the reverse order
|
source "$fasd_cache"
|
||||||
fasd -l -d -R |
|
unset fasd_cache
|
||||||
fzf --height=40% --layout=reverse --tiebreak=index --query="$*"
|
|
||||||
)"
|
alias v='f -e "$EDITOR"'
|
||||||
if [[ -d "$_fasd_ret" ]]; then
|
alias o='a -e xdg-open'
|
||||||
cd -- "$_fasd_ret"
|
|
||||||
elif [[ -n "$_fasd_ret" ]]; then
|
# alias j='zz'
|
||||||
print -- "$_fasd_ret"
|
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
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue