kickstart.nvim icon indicating copy to clipboard operation
kickstart.nvim copied to clipboard

telescope(?) issue in `init.lua`

Open componhead opened this issue 1 year ago • 2 comments

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?

componhead avatar May 14 '24 12:05 componhead

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

dam9000 avatar May 14 '24 13:05 dam9000

Is cwd a valid option for builtin.buffers?

jglueckstein avatar May 14 '24 15:05 jglueckstein

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.

dam9000 avatar May 14 '24 16:05 dam9000

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

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

thank you

componhead avatar May 14 '24 16:05 componhead

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

dam9000 avatar May 14 '24 17:05 dam9000

Thank you for the feedback.

componhead avatar May 14 '24 17:05 componhead