nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
16.77k stars 16.76k forks source link

telescope(?) issue in `init.lua` #931

Closed componhead closed 1 month ago

componhead commented 1 month ago

Hi. Adding this to init.lua, telescope preview doesn't works

      vim.keymap.set('n', '<leader>1', function()
        builtin.buffers { cwd = '' .. get_git_root() .. '/src/', prompt_title = 'Find src/ buffers', sort_mru = true, silent = true }
      end, { desc = 'Find src buffers' })

Am I using it correctly? Maybe a telescope issue?

dam9000 commented 1 month ago

You probably meant to use builtin.git_files instead of builtin.buffers ?

jglueckstein commented 1 month ago

Is cwd a valid option for builtin.buffers?

dam9000 commented 1 month ago

Hmm, seems that cwd is a valid option for builtin.buffers, from my testing I think it needs to be an absolute path. https://github.com/nvim-telescope/telescope.nvim/blob/master/doc/telescope.txt

builtin.buffers({opts})                          *telescope.builtin.buffers()*
    Lists open buffers in current neovim instance, opens selected buffer on
    `<cr>`
    Parameters: ~
        {opts} (table)  options to pass to the picker
    Options: ~
        {cwd}                   (string)    specify a working directory to
                                            filter buffers list by

@componhead is your issue that preview is not showing up, or you don't get a list of buffers at all? For preview to show up the terminal needs to be at least 120 columns wide otherwise the preview is not shown. The min width can be configured, or the layout changed so that the preview is split in vertical.

componhead commented 1 month ago

The issue is that I cannot see the preview. Maybe the current asciinema can help:

https://asciinema.org/a/2K3fzdzAnyf5bC1gz8Uaw3CUG

thank you

dam9000 commented 1 month ago

Ok I see and can reproduce the issue, here's a snippet that I used to reproduce:

vim.keymap.set('n', '<leader>1', function()
  builtin.buffers { cwd = vim.fn.getcwd() .. '/lua/', prompt_title = 'Find lua/ buffers', sort_mru = true, silent = true }
end, { desc = 'Find lua buffers' })

So Telescope shows the list of buffers and opens a preview window but it's empty. If I remove the cwd parameter then the preview works fine. This is definitely a Telescope issue, nothing to do with kickstart so it would be best if you report the issue there: https://github.com/nvim-telescope/telescope.nvim

componhead commented 1 month ago

Thank you for the feedback.