nvim-telescope / telescope.nvim

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

Ignore vcs and hidden flag not working #2908

Closed jacobrreed closed 8 months ago

jacobrreed commented 8 months ago

Description

I am trying to make the find_files command search all files, including items in .gitignore, but still hide all .git folders and node_modules. I have the following config

telescope.setup({
        pickers = {
          find_files = {
            find_command = {
              "rg",
              "--files",
              "--hidden",
              "--ignore-vcs",
              "-g",
              "!**/.git/*",
              "-g",
              "!**/node_modules/*",
            },
          },
        },
})

But no hidden files show up still

Neovim version

NVIM v0.10.0-dev-2258+g1405e5c8c
Build type: RelWithDebInfo
LuaJIT 2.1.1706708390

Operating system and version

MacOS 14.2.1

Telescope version / branch / rev

0.1.5

checkhealth telescope

==============================================================================
telescope: health#telescope#check

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0
- OK fd: found fd 8.5.2

===== Installed extensions ===== ~

Telescope Extension: `bookmarks` ~
- No healthcheck provided

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

Telescope Extension: `live_grep_args` ~
- No healthcheck provided

Telescope Extension: `notify` ~
- No healthcheck provided

Telescope Extension: `undo` ~
- No healthcheck provided

Steps to reproduce

        pickers = {
          find_files = {
            find_command = {
              "rg",
              "--files",
              "--hidden",
              "--ignore-vcs",
              "-g",
              "!**/.git/*",
              "-g",
              "!**/node_modules/*",
            },
          },
        },

Open a folder with .git folder and node_modules folder, add a file to .gitignore like dist/, then in dist folder add a file. Try searching for it using Telescope find_files, the file inside of dist wont show

Expected behavior

I expect the above to work, could be user error

Actual behavior

Still doesnt show any hidden files at all, all .gitignored files are still hidden

Minimal config

telescope.setup({
        pickers = {
          find_files = {
            find_command = {
              "rg",
              "--files",
              "--hidden",
              "--ignore-vcs",
              "-g",
              "!**/.git/*",
              "-g",
              "!**/node_modules/*",
            },
          },
        },
jamestrew commented 8 months ago

It's --no-ignore-vcs.

The rest looks good/works. Try this minimal config (save as min.lua under some tmp dir and launch neovim with nvim -nu min.lua)

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.loop.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",
    tag = "0.1.5",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-tree/nvim-web-devicons",
    },
    config = function()
      require("telescope").setup({
        pickers = {
          find_files = {
            find_command = {
              "rg",
              "--files",
              "--hidden",
              "--no-ignore-vcs",
              "-g",
              "!**/.git/*",
              "-g",
              "!**/node_modules/*",
              "-g", "!**/.repro/*", -- just to hide .repro rtp
            },
          },
        },
      })
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
jamestrew commented 8 months ago

image