Alpha Chen 2 years ago
parent abbd2703ef
commit f74a0d3584
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -41,7 +41,6 @@ zstyle ':prezto:load' pmodule \
'completion' \ 'completion' \
'history-substring-search' \ 'history-substring-search' \
'prompt' \ 'prompt' \
'fasd' \
'git' \ 'git' \
'ruby' \ 'ruby' \
'tmux' \ 'tmux' \

@ -49,11 +49,16 @@ if [ -e $HOMEBREW_PREFIX/opt/fzf/shell/completion.zsh ]; then
fi fi
[ -x "$(command -v kubectl)" ] && source <(kubectl completion zsh) [ -x "$(command -v kubectl)" ] && source <(kubectl completion zsh)
if [ -x "$(command -v terraform)" ]; then if [ -x "$(command -v terraform)" ]; then
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /opt/homebrew/bin/terraform terraform complete -o nospace -C /opt/homebrew/bin/terraform terraform
fi fi
if [ -e $HOMEBREW_PREFIX/share/z.lua/z.lua ]; then
eval "$(lua $HOMEBREW_PREFIX/share/z.lua/z.lua --init zsh enhanced fzf)"
fi
if [ $commands[fzf] ]; then if [ $commands[fzf] ]; then
[[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null [[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null
source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh" source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh"
@ -67,12 +72,6 @@ if [ $commands[fzf] ]; then
# https://github.com/junegunn/fzf/issues/164#issuecomment-581837757 # https://github.com/junegunn/fzf/issues/164#issuecomment-581837757
bindkey "ç" fzf-cd-widget bindkey "ç" fzf-cd-widget
z() {
[ $# -gt 0 ] && fasd_cd -d "$*" && return
local dir
dir="$(fasd -Rdl "$1" | fzf -1 -0 --no-sort +m)" && cd "${dir}" || return 1
}
# https://junegunn.kr/2016/07/fzf-git/ # https://junegunn.kr/2016/07/fzf-git/
is_in_git_repo() { is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1 git rev-parse HEAD > /dev/null 2>&1
@ -154,15 +153,12 @@ if [ $commands[fzf] ]; then
bind-git-helper f g t r h s bind-git-helper f g t r h s
unset -f bind-git-helper unset -f bind-git-helper
if [ $commands[fasd] ]; then # https://github.com/skywind3000/z.lua/wiki/Effective-with-fzf#define-a-new-z--i
# https://github.com/junegunn/fzf/wiki/examples#with-fasd-1 zlua_fzf() {
fasd_fzf() {
local dir local dir
dir="$(fasd -Rds "$1" | fzf -1 -0 --no-sort +m | sed -r 's/^[^[:space:]]+[[:space:]]+//')" && cd "${dir}" || return 1 dir="$(z -l "$1" | fzf --nth 2.. -1 -0 --inline-info --no-sort +m --reverse --tac | sed -r 's/^[^[:space:]]+[[:space:]]+//')" && cd "${dir}" || return 1
} }
alias j=fasd_fzf # override prezto's fasd integration alias j=zlua_fzf # override prezto's fasd integration
fi
fi fi
if [ $commands[exa] ]; then if [ $commands[exa] ]; then

Loading…
Cancel
Save