nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.44k stars 823 forks source link

Telescope live_grep not showing any results #2267

Open aldair-aguilar-clip opened 1 year ago

aldair-aguilar-clip commented 1 year ago

Description

Hello everyone! I come across this issue with a new fresh instalation of Telescope. The live_grep is not showing any results and idk why.

Captura de Pantalla 2022-12-08 a la(s) 16 27 22

The find files is working normally

Captura de Pantalla 2022-12-08 a la(s) 16 27 53

keymap("n", "<C-p>", "<cmd>lua require('telescope.builtin').live_grep()<cr>", opts)

Neovim version

0.39.2

Operating system and version

macOS Monterey 12.6.1

Telescope version / branch / rev

telesciope 0.1.0

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.5.3

## ===== Installed extensions =====

## Telescope Extension: `fzf`
  - OK: lib working as expected
  - OK: file_sorter correctly configured
  - OK: generic_sorter correctly configured

## Telescope Extension: `harpoon`
  - INFO: No healthcheck provided

Steps to reproduce

  1. open :Telscope live_grep

Expected behavior

Showing the search results of some string

Actual behavior

Is not showing any in the screen

Minimal config

local actions    = require('telescope.actions')
local previewers = require('telescope.previewers')
local builtin    = require('telescope.builtin')

require('telescope').load_extension('fzf')
require('telescope').load_extension('repo')
require('telescope').load_extension('harpoon')

local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
  return
end

telescope.setup{
  defaults = {
    vimgrep_arguments = {
     'rg',
     '--color=never',
     '--no-heading',
     '--with-filename',
     '--line-number',
     '--column',
     '--smart-case'
    },
    layout_config = {
      horizontal = {
        preview_cutoff = 120,
      },
      prompt_position = "top",
    },
    file_sorter = require('telescope.sorters').get_fzy_sorter,
    prompt_prefix = ' üîç ',
    color_devicons  = true,
    sorting_strategy = "ascending",
    file_previewer   = require('telescope.previewers').vim_buffer_cat.new,
    grep_previewer   = require('telescope.previewers').vim_buffer_vimgrep.new,
    qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,

    -- Default configuration for telescope goes here:
    -- config_key = value,
    path_display = { "smart" },
    mappings = {
      i = {
        -- map actions.which_key to <C-h> (default: <C-/>)
        -- actions.which_key shows the mappings for your picker,
        -- e.g. git_{create, delete, ...}_branch for the git_branches picker
        ["<C-h>"] = "which_key"
      },
      n = {
        ["<esc>"] = actions.close,
        ["<CR>"] = actions.select_default,
        ["<C-x>"] = actions.select_horizontal,
        ["<C-v>"] = actions.select_vertical,
        ["<C-t>"] = actions.select_tab,

        ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
        ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
        ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
        ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,

        ["j"] = actions.move_selection_next,
        ["k"] = actions.move_selection_previous,
        ["H"] = actions.move_to_top,
        ["M"] = actions.move_to_middle,
        ["L"] = actions.move_to_bottom,

        ["<Down>"] = actions.move_selection_next,
        ["<Up>"] = actions.move_selection_previous,
        ["gg"] = actions.move_to_top,
        ["G"] = actions.move_to_bottom,

        ["<C-u>"] = actions.preview_scrolling_up,
        ["<C-d>"] = actions.preview_scrolling_down,

        ["<PageUp>"] = actions.results_scrolling_up,
        ["<PageDown>"] = actions.results_scrolling_down,

        ["?"] = actions.which_key,
      }
    }
  },
  pickers = {
    -- Default configuration for builtin pickers goes here:
    -- picker_name = {
    --   picker_config_key = value,
    --   ...
    -- }
    -- Now the picker_config_key will be applied every time you call this
    -- builtin picker
  },
  extensions = {
    fzf = {
      override_generic_sorter = false,
      override_file_sorter = true,
      case_mode = "smart_case",
    }
    -- Your extension configuration goes here:
    -- extension_name = {
    --   extension_config_key = value,
    -- }
    -- please take a look at the readme of the extension you want to configure
  }
}
vandrieiev-godaddy commented 1 year ago
JLCarveth commented 1 year ago

make sure you have ripgrep installed. you can install it from ripgrep

Did you not read the checkhealth? They have ripgrep installed.

cuiko commented 1 year ago

same problem, My find_files is work, but live_grep do not work.

image
cuiko commented 1 year ago

same problem, My find_files is work, but live_grep do not work. image

In my case, it seems like can not search hidden file, like dotfiles.

cuiko commented 1 year ago

same problem, My find_files is work, but live_grep do not work. image

In my case, it seems like can not search hidden file, like dotfiles.

My bad, It works for me now. refer following

proto-h commented 1 month ago

Try add the --no-ignore argument like this:

require('telescope').setup {
  defaults = {
    -- See ~/.local/share/nvim/lazy/telescope.nvim/lua/telescope/finders/async_job_finder.lua
    vimgrep_arguments = {
      "rg",
      "--color=never",
      "--no-heading",
      "--with-filename",
      "--line-number",
      "--column",
      "--smart-case",
      "--no-ignore",
    },
  },
}
jamestrew commented 1 month ago

Is this still an issue? My recommendations are:

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})