Hey guys, I'm following the tutorial above, and in his video he doesn't do anything specific to show hidden files, but it works for him. My .config/nvim/after/plugin/telescope.lua file looks like this: I've looked up solutions but they all use a different syntax, and none work for me. Any idea how I can make the find_files command also show hidden files by using this syntax? Thanks!

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 0 points 3 years ago (1 child)

Hey, I only just had the time to try this out. I edited it as you suggested, but I still get an error when I :so after writing the file. Also, I don't have any fd command, and I'm not aware of anything extra that I added to nvim called fd.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 3 years ago* (last edited 3 years ago) (1 child)

    You will need to wrap the third argument to keymap.set in a function, like so:

    vim.keymap.set("n", "<leader>ff",  function()
      builtin.find_files({hidden=true})
    end, {})
    
  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 1 point 3 years ago (1 child)

    This seems to work, but for some reason when I do it, it gives me a massive list of all files (recursively) in the directory I ran nvim from. So if I run it in home, its going to be a massive list

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 3 years ago (1 child)

    Sorry, I missed the previous message. Glad you got it working with the help of @rewire@programming.dev.

    Regarding the massive list, yeah that is expected. If you haven't got fd or rg installed in you system, telescope falls back to regular find. Find doesn't have any sort of builtin ignore list, so it just lists all the files. If you are using the builtin.find_files normally, I think it executes (at least something close to)

    find -not -path "*/.*" -type f
    

    With the hidden=true, it does something along the lines of

    find . -type f
    

    Both of these commands are executed from the cwd (normally the directory you started nvim in). If you want it only show to a certain depth, you can use the telescope's setup to change the default find_command

    telescope.setup({
      pickers = {
        find_files = {
          find_command = { "find", "-maxdepth", "3", ".", "-type", "f"},
        },
      },
    }
    

    Modify that to your requirement and then use the keymap to call builtin.find_files() and it should work.

  • source
  • parent
  • hideshow 2 child comments