ibhagwan / fzf-lua

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

live grep > E484: Can't open file /usr/local/share/nvim/syntax/syntax.vim #950

Closed mikesmithgh closed 9 months ago

mikesmithgh commented 9 months ago

Info

fzf-lua configuration ```lua require('fzf-lua').setup({ }) ```

Description

When I use live-grep I am getting errors about opening syntax.nvim.

It appears to be looking for:

ADDITIONAL DATA DIRECTORY (DEFAULT)  
                  *$XDG_DATA_DIRS*              Nvim: stdpath("data_dirs")
    Unix:         /usr/local/share            /usr/local/share/nvim
                  /usr/share                  /usr/share/nvim
    Windows:      Not applicable              Not applicable

I build neovim nightly and have the environment variable set VIMRUNTIME=/Users/mike/gitrepos/neovim/runtime

/usr/local/share/nvim and usr/share/nvim do not exist on my machine

Demo

https://github.com/ibhagwan/fzf-lua/assets/10135646/6f25bf3d-e818-4c95-a446-2a597ae76978

ibhagwan commented 9 months ago

Can you run :FzfLua live_grep debug=true and post the command that will appear under [DEBUG] as the first outpt line?

Then run :new | term to open a new neovim terminal and run the same command inside?

mikesmithgh commented 9 months ago

sure, I ran it but the error doesn't seem to be coming from rg. Let me know if you need me to try anything else 👍

:FzfLua live_grep debug=true

*Rg> a                                                                                                        
  3/3 (0)                                                                                                     
  :: <ctrl-g> to Fuzzy Search                                                                                 
󰅂  [DEBUG]: rg --column --line-number --no-heading --color=always --smart-case --max-columns=4096 -e 'a'      
   󰈙 a.txt:1:1:a                                                                                              
   E484: Can't open file /usr/local/share/nvim/syntax/syntax.vim                                              

:new | term

bash-5.2$ rg --column --line-number --no-heading --color=always --smart-case --max-columns=4096 -e 'a'
a.txt:1:1:a                                                                                           
bash-5.2$ pwd                                                                                         
/Users/mike/tmp/test                                                                                  
bash-5.2$ ls -la                                                                                      
total 24                                                                                              
drwxr-xr-x    5 mike  staff   160 Dec 12 09:27 .                                                      
drwxr-xr-x@ 183 mike  staff  5856 Dec 12 09:46 ..                                                     
-rw-r--r--    1 mike  staff     2 Dec 12 11:44 a.txt                                                  
-rw-r--r--    1 mike  staff     2 Dec 12 11:44 b.txt                                                  
-rw-r--r--    1 mike  staff     2 Dec 12 11:44 c.txt                                                  
bash-5.2$                                                                                                                                                                                         
ibhagwan commented 9 months ago

sure, I ran it but the error doesn't seem to be coming from rg. Let me know if you need me to try anything else

In your post I see results are coming back as well as the error line, is everything else working as it should and this line is always appended as the last line? Does the same result set and error appear when you press ctrl-g as well?

What happens if you run grep with the same search term, for example :FzfLua grep search=a?

ibhagwan commented 9 months ago

I think I have a suspect for this issue @mikesmithgh, can you try live_grep_native? If my suspicions are correct it will work without the extra error message.

mikesmithgh commented 9 months ago

:FzfLua grep search=a results in the same. I tested using grep instead of rg.

grep

^^ I was typing the above before I saw you most recent message.

I just tested with live_grep_native and it worked without the error 👍

mikesmithgh commented 9 months ago

live_grep_native without the error 🥳

fzf-lua-no-error

ibhagwan commented 9 months ago

live_grep_native without the error

Confirming my suspicion, now I have to fix it :)

mikesmithgh commented 9 months ago

I should also mention I am seeing the issue on lsp_code_actions when I have previewer set to codeaction_native as well.

ibhagwan commented 9 months ago

I should also mention I am seeing the issue on lsp_code_actions when I have previewer set to codeaction_native as well.

You'll bee seeing it everywhere where an external neovim --headless command is used as proxy to run external commands / communicate with the main neovim instance, I'm going to commit a branch soon in an attempt to fix it and would be grateful if you can try it.

mikesmithgh commented 9 months ago

I should also mention I am seeing the issue on lsp_code_actions when I have previewer set to codeaction_native as well.

You'll bee seeing it everywhere where an external neovim --headless command is used as proxy to run external commands / communicate with the main neovim instance, I'm going to commit a branch soon in an attempt to fix it and would be grateful if you can try it.

sure just let me know 👍

ibhagwan commented 9 months ago

@mikesmithgh, can you try branch 950? https://github.com/ibhagwan/fzf-lua/tree/950

Can you also post the output of any command with debug so we can see the runtime

:FzfLua files debug=true with a custom runtime from AppImage: image

mikesmithgh commented 9 months ago

@ibhagwan That worked for me! the runtime looks good too 👍

[DEBUG]: VIMRUNTIME: /Users/mike/gitrepos/neovim/runtime                                                                                                           
[DEBUG]: rg --sort-files --column --line-number --no-heading --color=never --smart-case --hidden --max-columns=512 -g '!{.git,.worktrees,node_modules,.Trash}/' '' 

fzf-lua-live-grep

ibhagwan commented 9 months ago

https://github.com/ibhagwan/fzf-lua/commit/209e9405d2df949cbffe5b7b9329756b83bf2339

Great @mikesmithgh! Merged with main (minus the extra debug line).