2

Hello bash experts out there,

I'm new to using neovim and I'm having a hard time figuring out why my FZF is not showing hidden files, such as .gitignore and `.htaccess``

Here's what I have currently in my .vimrc:

let g:fzf_action = { 'enter': 'tab split' }
let g:fzf_height = '25%'
map <leader>t :FZF --reverse<cr>

I've looked at the github issue and I didn't really understand what to do with the command they used.

Got it. Needed to add the --hidden flag.

I've tried to add the hidden flag by doing:

map <leader>t :FZF --reverse --hidden<cr>

But it returns an error saying error runnning --expect=enter...

I've also tried adding this:

let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -l ""'

But after adding this, whenever I run the command, it's always returning a 0/0 no result found no matter what I type, even if the search is empty.

2
  • You should use -g instead of -l. Try this let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
    – nima
    Aug 16 '16 at 4:18
  • @nima I've tried the command you've sent and the result is the same. Whenever I run the command, it's returning 0/0 no result found.
    – Chin Leung
    Aug 16 '16 at 14:12
1

Run this command in bash:

export FZF_DEFAULT_COMMAND="find . -path '*/\.*' -type d -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//"

This should resolve the problem with dot files not being found, but files inside any hidden directory (for example files inside .git or .svn directories) are still ignored.
If you need to list files inside hidden directories too (which you probably don't) try this:

export FZF_DEFAULT_COMMAND="find . -type f -print -o -type l -print 2> /dev/null | sed s/^..//"

Then fzf should work the way you want it to.

5
  • Can you tell me how would I ignore file like .DS_Store? I've tried adding -not -name '.DS_Store' but it doesn't seem to work.
    – Chin Leung
    Aug 16 '16 at 14:45
  • It is important where you add new conditions. If you need to prune .DS_Store as well as other dot files, one way is to add -o -name .DS_Store before -prune so the final export command (based on first command in the answer) would be export FZF_DEFAULT_COMMAND="find . -path '*/\.*' -type d -o -name .DS_Store -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//"
    – nima
    Aug 16 '16 at 21:53
  • I've tried to add the -o -name .DS_Store as you stated, however it's now showing files under the .git folder.
    – Chin Leung
    Aug 16 '16 at 22:49
  • Try this export FZF_DEFAULT_COMMAND=‌​"find . \( -path '*/\.*' -type d -o -name .DS_Store \) -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//"
    – nima
    Aug 16 '16 at 23:59
  • It returns an empty result set now.
    – Chin Leung
    Aug 17 '16 at 1:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.