Zane- / cder.nvim

A telescope.nvim extension to quickly change Neovim's working directory.
56 stars 3 forks source link

How to search the subdirectories of cwd #9

Closed liangkarl closed 3 months ago

liangkarl commented 3 months ago

Hi,

My configuration is like this

        extensions = {
          cder = {
            previewer_command = 'tree -L 1 -F --dirsfirst -h',
            pager_command = 'cat',
            dir_command = { 'fd', '-I', '--type=d', '.', vim.fn.getcwd() },
            -- dir_command = { 'fd', '-I', '--type=d', '.', vim.fn.expand('%:p:h') },
          }
        }

What I want to do is to search all the subdirectories under current cwd. When I change cwd such as :cd, I could get different subdirectory entries. However, no matter what kind of the search path like getcwd() or expand('%:p:h'), the "Results" list is always the same, showing the subdirectories under the path where I open nvim. Does anyone know how to make it change? Thanks

image

liangkarl commented 3 months ago

Finnally, the subdirectory list has changed by using this configuration

extensions = {
  cder = {
    previewer_command = 'tree -L 1 -F --dirsfirst -h',
    pager_command = 'cat',
    dir_command = { 'fd', '-I', '--type=d', '.', function()
      vim.fn.getcwd()
    end },
  }
}