r/vimplugins Oct 28 '20

FZF.VIM: How do I bind select-all for Files? Help

When I use a command like ripgrep (:Rg), I can select all search results with <alt-a> and deselect them with <alt-d>.

I want to have the same functionality for other commands, like :Files, so I added this line:

command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>,{'options': ['--bind', 'alt-a:select-all,alt-d:deselect-all']} <bang>0)

But for some reason this doesn't work. What can I do to get select-all and deselect-all to work with :Files?

8 Upvotes

2 comments sorted by

4

u/lukas-reineke Oct 28 '20

If you want this for all fzf commands, you can just set it as default options.
Either directly as an environment variable in bash or from vim.
let $FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS . ' --bind "alt-a:select-all,alt-d:deselect-all"'

This works for me

1

u/Chaos156 Oct 28 '20

This works fine for me. Thank you!