ibhagwan / fzf-lua

Improved fzf.vim written in lua
GNU Affero General Public License v3.0
2.15k stars 141 forks source link

Global environment variable FZF_DEFAULT_COMMAND is ignored #582

Closed illia-danko closed 1 year ago

illia-danko commented 1 year ago

I use ripgrep in FZF_DEFAULT_COMMAND environment variable as a base search command, mostly for filtering out unneeded directories: export FZF_DEFAULT_COMMAND="rg --files --hidden -g '!{.git,.svn,.hg,CVS,.bzr,vendor,node_modules,dist,venv,elm-stuff,.clj-kondo,.lsp}'"

However fzf-lua seems to ignore the --hidden setting or use entirely a different command than rg.

How to teach fzf-lua.files to respect FZF_DEFAULT_COMMAND environment variable? Found some manipulation of FZF_DEFAULT_COMMAND inside the plugin code, but haven't followed what's going on there.

illia-danko commented 1 year ago

Found a workaround: lua require'fzf-lua'.files({ cmd = vim.env.FZF_DEFAULT_COMMAND }) and it satisfies my usage.

ibhagwan commented 1 year ago

Found a workaround: lua require'fzf-lua'.files({ cmd = vim.env.FZF_DEFAULT_COMMAND }) and it satisfies my usage.

That’s correct usage, the FZF_DEFAULT_COMMAND will never be used unless you use fzf_exec with no arguments, the use of the cmd argument is the recommended way.