Closed winston0410 closed 2 years ago
No update should cause live_grep
to stop functioning, given that I'm not sure when was your previous update let's try a few things:
grep
or grep_project
work?live_grep_old
?:lua require'fzf-lua'.live_grep({ multiprocess = false })
:lua require'fzf-lua'.live_grep({ multiprocess=true, debug=true })
For the last one, the first line should post the underlying rg
command as the first result, can you run it in the shell and see if there are any results and also post it here?
Btw, the below can be reduced due to a new option named show_cwd_header
:
local function getCwd()
local path = require("fzf-lua.path").git_root(vim.loop.cwd(), true) or vim.loop.cwd()
local header = ('--header="cwd = %s"'):format(vim.fn.shellescape(path))
return { cwd = path, fzf_cli_args = header }
end
local function getCwd()
local path = require("fzf-lua.path").git_root(vim.loop.cwd(), true) or vim.loop.cwd()
return { cwd = path, show_cwd_header = true }
end
Thank you so much for your reply. I have changed my code to show_cwd_header
, but still it doesn't work.
This is the output of :lua require'fzf-lua'.live_grep({ multiprocess=true, debug=true })
'/etc/profiles/per-user/hugosum/bin/nvim' -n --headless --clean --cmd 'lua loadfile([[/home/hugosum/.loca
l/share/nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/libuv.lua]])().spawn_stdio({debug=true,cmd=[[rg -
-column --line-number --no-heading --color=always --smart-case --max-columns=512 {q} ]],git_icons=true,fi
le_icons=true,color_icons=true},[[_G._devicons_path='\''/home/hugosum/.local/share/nvim/site/pack/packer/
start/nvim-web-devicons/lua/nvim-web-devicons.lua'\''; _G._fzf_lua_server='\''/tmp/nvimZKSyGq/2'\''; retu
rn require("make_entry").file]],[[return require("make_entry").preprocess]])'
And live_grep_old
is working perfectly fine. Not sure what went wrong during previous update there.
And live_grep_old is working perfectly fine. Not sure what went wrong during previous update there.
That's great, at least you have an alternative.
I'd still like to understand why it's not working, did you happen to try with multiprocess = false
?
The output of the debug command looks accurate, can you run it again with debug=true
and then type in the search field, the first result should be a [DEBUG]
line with the rg
command generated by your typing, let me know if yours looks similar?
I modified the output of the command from your debug output a bit, can you run the below in the shell and let me know if you're seeing any results (the output should be rg
with icons):
'/etc/profiles/per-user/hugosum/bin/nvim' -n --headless --clean --cmd 'lua loadfile([[/home/hugosum/.local/share/nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/libuv.lua]])().spawn_stdio({debug=true,cmd=[[rg --column --line-number --no-heading --color=always --smart-case --max-columns=512 a]],git_icons=true,file_icons=true,color_icons=true},[[_G._devicons_path='\''/home/hugosum/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/lua/nvim-web-devicons.lua'\''; return require("make_entry").file]],[[return require("make_entry").preprocess]])'
- lua require'fzf-lua'.live_grep({ multiprocess = false })
No I am being lazy, and I didn't tried the multiprocess = false
. Tried it just now, and it is working. I guess the issue can be narrowed down to multiprocess = true
For running multiprocess = true
, I get this, nothing really
And for that command, I run it in shell and I get the output you have described like this:
For running multiprocess = true, I get this, nothing really
I think I see the issue here, althought the command isn't fully showing I can see you typed flake
but the generated command shows let...
, would you be able to run this again and let me know the full text of the DEBUG
command?
I reduced the number of rg
arguments so we will be able to see what's in the typed text better, you can also press <F2>
to make fzf-lua fullscreen which will also help with visibilty:
:lua require'fzf-lua'.live_grep({ debug=true, cmd='rg --column --line-number' })
Unfortunately I haven't configure <F2>
key in my macbook that runs NixOS lol I can't try that for you. But I have just tried that command, this is what I get:
Well this definitely confirms the bug, now I gotta figure out how on earth this can happen :-)
Sure no problem. Thank you for maintaining this!
I think I found the issue, I suspect your NixOS supplies extra arguments to the neovim cli (python3 path in your case) which was messing up positional arguments I was relying upon for live_grep
, I now use the last argument instead to store the query so hopefully this should work regardless of number of arguments supplied.
If this doesn't work can you run once again with debug=true
? I added debug info which would give us information how many arguments were supplied and what is the last argument, this is how it should look like:
I have just updated and tried it again, and it is working perfectly fine! Thanks for your good work!
Fantastic! tysm for the update and patience debugging this issue @winston0410
I have updated
fzf-lua
yesterday, and I found that live grep stopped working without any error. It cannot find any files in the directory now:My config:
Version of
fzf-lua
I am in:Maybe there is an update on directory setting? I am not really sure.