Skip to content

Commit

Permalink
Update FZF_DEFAULT_COMMAND
Browse files Browse the repository at this point in the history
Update `FZF_DEFAULT_COMMAND` per suggestion in #69. The plugin also
only sets `FZF_DEFAULT_COMMAND` when it isn't already set so that
any custom user settings don't get stepped on by the plugin.

Fixes #69.

Signed-off-by: Joe Block <[email protected]>
  • Loading branch information
unixorn committed Mar 6, 2024
1 parent 502e367 commit c9a3506
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fzf-zsh-plugin.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ fi
unset xdg_path

# Install fzf into ~ if it hasn't already been installed.
if [[ ! _fzf_has fzf ]]; then
_fzf_debugOut "FZF_PATH: $FZF_PATH"
if ! _fzf_has fzf; then
if [[ ! -d $FZF_PATH ]]; then
git clone --depth 1 https://github.com/junegunn/fzf.git $FZF_PATH
$FZF_PATH/install --bin
Expand All @@ -56,6 +57,7 @@ fi

# Install some default settings if user doesn't already have fzf
# settings configured.
_fzf_debugOut "fzf_conf: $fzf_conf"
if [[ ! -f $fzf_conf ]]; then
echo "Can't find a fzf configuration file at $fzf_conf, creating a default one"
cp "$(dirname $0)/fzf-settings.zsh" $fzf_conf
Expand All @@ -69,7 +71,7 @@ unset fzf_conf
# Reasonable defaults. Exclude .git directory and the node_modules cesspit.
# Don't step on user's FZF_DEFAULT_COMMAND
if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
export FZF_DEFAULT_COMMAND='find . -type f ( -path .git -o -path node_modules ) -prune'
export FZF_DEFAULT_COMMAND='find . -type f -not \( -path "*/.git/*" -o -path "./node_modules/*" \)'
export FZF_ALT_C_COMMAND='find . -type d ( -path .git -o -path node_modules ) -prune'

if _fzf_has rg; then
Expand Down

0 comments on commit c9a3506

Please sign in to comment.