Fzf: Ctrl-T includes errors when files don't have required permission

Created on 22 Mar 2019  路  2Comments  路  Source: junegunn/fzf

  • Category

    • [x] fzf binary

    • [ ] fzf-tmux script

    • [x] Key bindings

    • [x] Completion

    • [ ] Vim

    • [ ] Neovim

    • [ ] Etc.

  • OS

    • [x] Linux

    • [ ] Mac OS X

    • [ ] Windows

    • [ ] Windows Subsystem for Linux

    • [ ] Etc.

  • Shell

    • [x] bash

    • [ ] zsh

    • [ ] fish

I've edited $FZF_DEFAULT_COMMAND as following in ~/.bashrc:

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

Now, as expected running $ fzf from $HOME directory works perfectly. It includes hidden files except all the files inside and and all .git directories. But when I use Ctrl-T for completion in $HOME directory, it also includes errors because some files don't have permissions. For example:

> ERR: Error opening directory ./.gvfs: Permission denied

This error message messes up the output of interactive fzf fuzzy matching. Is there any way I can fix it?

question

Most helpful comment

Thanks for this, it was driving me nuts. For completeness, based on junegunn's answer, your CTRL-T command should look like this:

export FZF_CTRL_T_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*" --glob "!node_modules/*" --glob "!vendor/*" 2> /dev/null'

All 2 comments

Redirect stderr to /dev/null. i.e. 2> /dev/null

Thanks for this, it was driving me nuts. For completeness, based on junegunn's answer, your CTRL-T command should look like this:

export FZF_CTRL_T_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*" --glob "!node_modules/*" --glob "!vendor/*" 2> /dev/null'

Was this page helpful?
0 / 5 - 0 ratings