stevearc / dressing.nvim

Neovim plugin to improve the default vim.ui interfaces
MIT License
1.73k stars 32 forks source link

fix(telescope): allow passing theme options to select #20

Closed akinsho closed 2 years ago

akinsho commented 2 years ago

This PR adds the ability for a user to specify the options they would like to add to the telescope picker. Currently, a user can only choose a theme as a string but cannot determine things like the width, height, border characters etc. This PR adds the ability for a user to pass the theme object or a string to dressing to have that be used by telescope.

e.g.

use {'dressing.nvim', config = function()
    config = function()
        require('dressing').setup {
          select = {
            winblend = 2,
            telescope = {
              theme = require('telescope.themes').get_cursor { -- or 'cursor'
                border_chars = {chars_i_like},
                layout_config = {
                  height = function(self, _, max_lines)
                    return random_height_i_computed
                  end,
                },
              },
            },
          },
        }
      end

This is similar to how https://github.com/nvim-telescope/telescope-ui-select.nvim works, tbh I'm not actually sure passing { previewer = false } is necessary since that plugin doesn't bother to do that and it doesn't try and create a preview 🤷🏿

stevearc commented 2 years ago

LGTM, thanks for the PR!