Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grep not working #506

Closed
debianw opened this issue Feb 7, 2021 · 18 comments · Fixed by #1024
Closed

Grep not working #506

debianw opened this issue Feb 7, 2021 · 18 comments · Fixed by #1024
Assignees
Labels
bug Something isn't working

Comments

@debianw
Copy link

debianw commented Feb 7, 2021

Screen Shot 2021-02-06 at 7 44 21 PM

Config

nnoremap <leader>fg <cmd>Telescope live_grep<cr>

Description

Grep not working

Expected Behavior

Actual Behavior
Nothing shows in the preview screen. A Lua error shows up [telescope] ^I...ig/nvim/plugged/telescope.nvim/lua/telescope/pickers.lua:451: in function <...ig/nvim/plugged/telescope.nvim/lua/telescope/pickers.lua:413>

Details

Reproduce

Example:

  1. nvim .
  2. :Telescope live_grep
  3. type something

NVIM v0.5.0-dev+1064-gb96db38af
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Linux Ubuntu

Configuration

...
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>

 call plug#begin()
   Plug 'neoclide/coc.nvim', {'branch': 'release'}
   Plug 'preservim/nerdtree'
   Plug 'morhetz/gruvbox'
   Plug 'vim-airline/vim-airline'
   Plug 'vim-airline/vim-airline-themes'
   Plug 'nvim-lua/popup.nvim'
   Plug 'nvim-lua/plenary.nvim'
   Plug 'nvim-telescope/telescope.nvim'
   Plug 'dracula/vim'
   Plug 'ryanoasis/vim-devicons'
call plug#end()
...
EOF
@debianw debianw added the bug Something isn't working label Feb 7, 2021
@delphinus
Copy link
Member

Do you have rg executable? live_grep uses vimgrep_arguments in config. See Telescope Defaults.

@SuperCuber
Copy link

Is there a way to live grep without installing external dependencies?

@Conni2461
Copy link
Member

@SuperCuber It might be possible to to use grep you just need to end up with a line that we can interpret. Our regex:

local _, _, filename, lnum, col, text = string.find(t.value, [[([^:]+):(%d+):(%d+):(.*)]])

Example:

./lua/telescope/previewers/buffer_previewer.lua:659:25:  return previewers.new_buffer_previewer {

Just change your vimgrep_arguments to the desired grep command with args.

If you have something please let me know we could put something like this in the wiki :)

@robbycostales
Copy link

I have the same problem, but only when I switch a different Anaconda environment. On my base environment, the live grep search works fine.

@Conni2461
Copy link
Member

@robbycostales Does ripgrep in terminal returns something in that different anaconda env?

@robbycostales
Copy link

@robbycostales Does ripgrep in terminal returns something in that different anaconda env?

Yes, the command was not found in my new environment (but worked in my base env), so I used conda install -c conda-forge ripgrep. This got it working, thanks!---but I do wonder: is there a way to not have to install these dependencies for each new environment, i.e. always point to my base installation for them?

@Conni2461

@mherna
Copy link

mherna commented Feb 14, 2021

I have rg installed and I'm running into a similar issue live grep returned:

[telescope] ^I...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:453: in function <...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:415>

@Conni2461
Copy link
Member

Can i get the whole error message. :messages to show it. Thanks :)

@mherna
Copy link

mherna commented Feb 15, 2021

@Conni2461 my bad didn't have fzf installed, brew install fzf solved the issue...

Is fzf a requirement? In that case shouldn't the readme.md be updated? Didn't see it in Optional dependences, so I thought it was not required

|| [telescope] [WARN  05:36:37] ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:458: Failed with msg:  .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:80: fzf: Executable not found
|| [telescope] stack traceback:
|| [telescope] ^I.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:80: in function 'new'
|| [telescope] ^I...ck/packer/start/telescope.nvim/lua/telescope/finders.lua:85: in function 'finder'
|| [telescope] ^I...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:454: in function <...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:453>
|| [telescope] ^I[C]: in function 'pcall'
|| [telescope] ^I...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:453: in function <...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:415>

@Conni2461
Copy link
Member

Is fzf a requirement?

Only if you are using fzf-writer

@zupatisc
Copy link

Maybe ripgrep should be listed under non-optional dependencies considering that a builtin picker is using it.

@matu3ba
Copy link

matu3ba commented Sep 6, 2021

Maybe ripgrep should be listed under non-optional dependencies considering that a builtin picker is using it.

I would favor generating a vim help page for the plugin and then separating the README. The README is already far too long.
Personally I like how nvim-dap does it.

Disclaimer: I wrote the Troubleshooting article in the wiki.

@tristone13th
Copy link

Can it use the vim internal grep such as vimgrep?

@lvela
Copy link

lvela commented Oct 19, 2022

For those who need to install ripgrep: https://github.com/BurntSushi/ripgrep#installation

@manojm-dev
Copy link

you can also install ripgrep by $sudo apt install ripgrep in ubuntu it just works as charm.

@diegolikescode
Copy link

Do you have rg executable? live_grep uses vimgrep_arguments in config. See Telescope Defaults.

It worked for me, thank you!

@PAVAN507-STAR
Copy link

Do you have rg executable? live_grep uses vimgrep_arguments in config. See Telescope Defaults.

worked for me. Thanks a bunch man

@adarmaori
Copy link

I'm getting the same behavior from the grep window but without the error message. (I have ripgrep installed and working)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.