Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't find dot files? #634

Closed
4 of 14 tasks
ngnguyen1 opened this issue Aug 6, 2016 · 15 comments
Closed
4 of 14 tasks

can't find dot files? #634

ngnguyen1 opened this issue Aug 6, 2016 · 15 comments
Labels

Comments

@ngnguyen1
Copy link

  • Category
    • fzf binary
    • fzf-tmux script
    • Key bindings
    • Completion
    • Vim
    • Neovim
    • Etc.
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

I can't find any dot files as .vimrc, .bashrc. Is it supported?

2016-08-06-175459_1920x1080_scrot

@junegunn
Copy link
Owner

junegunn commented Aug 6, 2016

The default commands fzf uses do not include hidden files. If you want hidden files in the list, you have to define your own $FZF_DEFAULT_COMMAND or $FZF_CTRL_T_COMMAND depending on the context.

For example:

export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""'

@nimamo
Copy link

nimamo commented Aug 16, 2016

When I try export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""' fzf stops working in bash shell and lists no files at all (not only dot files, but nothing at all) but it works as expected in vim. I modified the default command and tried export FZF_DEFAULT_COMMAND="find . -path '*/\.*' -type d -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//" and fzf worked as expected both in bash and in vim. I guess this is related to how ag generates its output?

@junegunn
Copy link
Owner

junegunn commented Aug 16, 2016

@nimamo Have you checked the command itself (ag --hidden --ignore .git -g "") works in bash?

@nimamo
Copy link

nimamo commented Aug 16, 2016

@junegunn Yes and it works as expected.

@junegunn
Copy link
Owner

@nimamo How about ag --hidden --ignore .git -g "" | cat? If it fails, upgrade ag.

@nimamo
Copy link

nimamo commented Aug 16, 2016

@junegunn This command works. I tried the same procedure ( export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""' ) on a different Linux installation and it just worked fine. This doesn't seem to be a bug in fzf, yet seeing different results from fzf in bash and :FZF in Vim is worth noticing.

@junegunn
Copy link
Owner

@nimamo Please make sure you have the latest version of ag installed. Probably related: #573

VegaFromLyra added a commit to VegaFromLyra/dotfiles that referenced this issue Oct 9, 2017
- By following the solution posted in junegunn/fzf#634
- Set it up for both bash and zsh
volcain-io added a commit to volcain-io/dotfiles that referenced this issue Oct 31, 2018
@rikhuijzer
Copy link

rikhuijzer commented Aug 2, 2019

The command to use rg (ripgrep) instead of ag (the_silver_searcher):

export FZF_DEFAULT_COMMAND='rg --hidden --no-ignore -l ""'

@asolopovas
Copy link

asolopovas commented May 29, 2020

I get the following [Command failed: ag --hidden --ignore .git -g ""] even though I do have ag installed

@junegunn
Copy link
Owner

See if $SHELL -c 'ag --hidden --ignore .git -g ""' works on you shell because that's what fzf does.

@AiRyunn
Copy link

AiRyunn commented Jun 28, 2020

A faster command for ripgrep is

export FZF_DEFAULT_COMMAND='rg --hidden --no-ignore --files'

which does not search the content of files.

@Mel28vin
Copy link

Mel28vin commented Feb 3, 2021

export FZF_DEFAULT_COMMAND='rg --files --follow --no-ignore-vcs --hidden -g "!{node_modules/,.git/}"'

This works for me!

@David-Else
Copy link

@junegunn I would like to include dot files and exclude ./.git without adding another command line dependency. It seems by default fzf excludes the .git folder, I came up with:

export FZF_DEFAULT_COMMAND='find . -path './.git' -prune -o -print'

But I am not sure I am getting the original behaviour. Can you advise what to add to my .bashrc to keep the original behaviour and include dot files. Bonus would be to exclude node_modules :). Cheers!

@erikw
Copy link

erikw commented Oct 29, 2021

Thank you @Mel28vin!

@junegunn As it seems to be a quite a common use case to want to include dot files or files descending from a dot directory, I think it would be very helpful is this as easy to configure directly in fzf with a dedicated setting (that can be set with FZF_DEFAULT_OPTS). Could we open up this issue again, or should we open a new issue? :)

It has also been discussed in the related fzf.vim junegunn/fzf.vim#194

@dharmaturtle
Copy link

Tweaking Mel28vin's command so it ignores node_module and .git sub-directories:

export FZF_DEFAULT_COMMAND="rg --files --follow --no-ignore-vcs --hidden -g '!{**/node_modules/*,**/.git/*}'"

Relevant ripgrep thread.

flavono123 added a commit to flavono123/dotfiles that referenced this issue Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants