Closed zigotica closed 1 month ago
we are parsing the viml command into a lua call, so yeah we are interpreting numbers as strings iirc. If you have that youcase its best you use the lua interface directly
Hello, thank you for the answer. If I understand correctly, you're suggesting I use the lua method directly, so instead of :Telescope grep_string search=3
I would be using lua require('telescope.builtin').live_grep()
? Problem with that, is it is not a direct equivalent, since this opens a modal where I can write the number and returns files containing that number, but I cannot fzf the files (the filter is the actual number being searched). Sorry, maybe there is a documentation page for this specific "issue" but cannot find it.
It would be like :lua require('telescope.builtin').grep_string({ search = '3' })
I see mappings like this frequently to prompt for the search term.
nnoremap <leader>ps :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ") })<CR>
Actually I don't think it hurts to cast the search
value into a string.
Thanx, works perfectly!
Description
I am getting an error when trying to grep for number, nit sure if this is expected or not.
Neovim version
Operating system and version
macOS 15.0
Telescope version / branch / rev
latest master
checkhealth telescope
Steps to reproduce
Expected behavior
Opens a modal with fzf-able files including that number (3)
Actual behavior
Error executing Lua callback: ...im/lazy/telescope.nvim/lua/telescope/builtin/files.lua:21: attempt to index local 'string' (a number value) stack traceback: ...im/lazy/telescope.nvim/lua/telescope/builtin/files.lua:21: in function 'escape_chars' ...im/lazy/telescope.nvim/lua/telescope/builtin/files.lua:205: in function 'v' ...im/lazy/telescope.nvim/lua/telescope/builtin/files.lua:644: in function 'v' .../nvim/lazy/telescope.nvim/lua/telescope/builtin/init.lua:587: in function <.../nvim/lazy/telescope.nvim/lua/telescope/builtin/init.lua:546> ...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:188: in function 'run_command' ...share/nvim/lazy/telescope.nvim/lua/telescope/command.lua:259: in function 'load_command' ...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:108: in function <...ocal/share/nvim/lazy/telescope.nvim/plugin/telescope.lua:107>
Minimal config