Improve fzf detection of grep tools

Prefer faster tools, if found. First rg, then ag, then default
This commit is contained in:
ViViDboarder 2020-02-20 14:12:29 -08:00
parent 303bd56703
commit 3a4654aab4
3 changed files with 22 additions and 4 deletions

View File

@ -76,5 +76,14 @@ export LSCOLORS=ExFxCxDxBxegedabagacad
# Vim colors # Vim colors
[ -n "$VIM_COLOR" ] || export VIM_COLOR="$(eval "$HOME/bin/get_vim_colorscheme.sh")" || export VIM_COLOR='wombat256mod' [ -n "$VIM_COLOR" ] || export VIM_COLOR="$(eval "$HOME/bin/get_vim_colorscheme.sh")" || export VIM_COLOR='wombat256mod'
export FZF_DEFAULT_COMMAND='ag -g ""' if type rg &> /dev/null; then
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND \$dir" export FZF_DEFAULT_COMMAND='rg --files'
# export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden'
elif type ag &> /dev/null; then
export FZF_DEFAULT_COMMAND='ag -g ""'
fi
if [ -n "$FZF_DEFAULT_COMMAND" ]; then
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND \$dir"
fi
# vim: set filetype=sh:

View File

@ -87,3 +87,5 @@ if [ -n "$PS1" ] && [ -z "$IS_BASH_PROFILE_LOADED" ] ; then
# shellcheck source=bash_profile # shellcheck source=bash_profile
source "$HOME/.bash_profile" source "$HOME/.bash_profile"
fi fi
# vim: set filetype=sh:

View File

@ -7,8 +7,15 @@ set -gx XDG_CACHE_HOME "$HOME/.cache"
set -gx ANT_OPTS "-Xmx2048m -Xms512m" set -gx ANT_OPTS "-Xmx2048m -Xms512m"
# FZF # FZF
set -gx FZF_DEFAULT_COMMAND 'ag -g ""' if type -q rg
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND \$dir" set -gx FZF_DEFAULT_COMMAND 'rg --files'
# set -gx FZF_DEFAULT_COMMAND 'rg --files --no-ignore-vcs --hidden'
else if type -q ag
set -gx FZF_DEFAULT_COMMAND 'ag -g ""'
end
if [ -n "$FZF_DEFAULT_COMMAND" ]
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND \$dir"
end
# Vim Colors so that they can be set by env # Vim Colors so that they can be set by env
set -q VIM_COLOR; set -gx VIM_COLOR (eval $HOME/bin/get_vim_colorscheme.sh); or set -gx VIM_COLOR wombat256mod set -q VIM_COLOR; set -gx VIM_COLOR (eval $HOME/bin/get_vim_colorscheme.sh); or set -gx VIM_COLOR wombat256mod