zsh: cleanup
This commit is contained in:
@@ -94,29 +94,11 @@ export FZF_DEFAULT_OPTS='
|
|||||||
--color=info:#5c6a72,prompt:#5c6a72,pointer:#5c6a72
|
--color=info:#5c6a72,prompt:#5c6a72,pointer:#5c6a72
|
||||||
--color=marker:#5c6a72,spinner:#5c6a72,header:#5c6a72'
|
--color=marker:#5c6a72,spinner:#5c6a72,header:#5c6a72'
|
||||||
|
|
||||||
## ripgrep-all
|
|
||||||
# needs https://github.com/phiresky/ripgrep-all
|
|
||||||
rga-fzf() {
|
|
||||||
RG_PREFIX="rga --files-with-matches"
|
|
||||||
local file
|
|
||||||
file="$(
|
|
||||||
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
|
|
||||||
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
|
|
||||||
--phony -q "$1" \
|
|
||||||
--bind "change:reload:$RG_PREFIX {q}" \
|
|
||||||
--preview-window="70%:wrap"
|
|
||||||
)" &&
|
|
||||||
echo "opening $file" &&
|
|
||||||
xdg-open "$file"
|
|
||||||
}
|
|
||||||
zle -N rga-fzf
|
|
||||||
bindkey '^S' "rga-fzf"
|
|
||||||
|
|
||||||
## fzf Bindings in zsh (C-r and C-f)
|
## fzf Bindings in zsh (C-r and C-f)
|
||||||
|
# c/p from ohmyzsh
|
||||||
if [[ -x $(which fzf 2> /dev/null) ]]
|
if [[ -x $(which fzf 2> /dev/null) ]]
|
||||||
then
|
then
|
||||||
# The code at the top and the bottom of this file is the same as in completion.zsh.
|
# some setup
|
||||||
# Refer to that file for explanation.
|
|
||||||
if 'zmodload' 'zsh/parameter' 2>'/dev/null' && (( ${+options} )); then
|
if 'zmodload' 'zsh/parameter' 2>'/dev/null' && (( ${+options} )); then
|
||||||
__fzf_key_bindings_options="options=(${(j: :)${(kv)options[@]}})"
|
__fzf_key_bindings_options="options=(${(j: :)${(kv)options[@]}})"
|
||||||
else
|
else
|
||||||
@@ -132,11 +114,9 @@ then
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
'emulate' 'zsh' '-o' 'no_aliases'
|
'emulate' 'zsh' '-o' 'no_aliases'
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
[[ -o interactive ]] || return 0
|
[[ -o interactive ]] || return 0
|
||||||
|
|
||||||
# CTRL-F - Paste the selected file path(s) into the command line
|
# CTRL-F - Paste the selected file path(s) into the command line
|
||||||
@@ -201,7 +181,7 @@ then
|
|||||||
eval $__fzf_key_bindings_options
|
eval $__fzf_key_bindings_options
|
||||||
'unset' '__fzf_key_bindings_options'
|
'unset' '__fzf_key_bindings_options'
|
||||||
}
|
}
|
||||||
else
|
else # fzf is not installed
|
||||||
bindkey '^R' history-incremental-search-backward
|
bindkey '^R' history-incremental-search-backward
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user