nvim-telescope / telescope-ui-select.nvim

MIT License
774 stars 18 forks source link

Customise size of floating window #9

Closed axieax closed 2 years ago

axieax commented 2 years ago

Just wondering if it's possible to customise the size of the floating window. I usually use dressing.nvim and love the dimensions of their Telescope popup for vim.ui.select. Just wanted to see if it was possible to replicate the exact dimensions from dressing.nvim since I'm planning on transitioning my vim.ui.select customiser to this plugin.

tosiek88 commented 2 years ago

Hi I am using LunarVim but in your case should be something similar


lvim.builtin.telescope.on_config_done = function()
-- your conifguration
    local opts = {
        winblend = 15,
        layout_config = {
            prompt_position = "top",
            width = 80,
            height = 12,
        },
        borderchars = lvim.builtin.telescope.defaults.borderchars,
        border = {},
        previewer = false,
        shorten_path = false,
    }

    local dropdown = require("telescope.themes").get_dropdown(opts)
    lvim.builtin.telescope.extensions["ui-select"] = dropdown
    local ext = require("telescope").load_extension("ui-select")
        lvim.builtin.which_key.mappings["l"].a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code actions" }
end
axieax commented 2 years ago

Thanks! I've managed to resolve this with:

require("telescope").setup({
  extensions = {
    ["ui-select"] = { layout_strategy = "center" },
  }
})

Still not perfect since I cannot set a maximum width, but an improvement nonetheless.

tosiek88 commented 2 years ago

Maybe Ivy theme will be an option?

You can test fast

Telescope current_buffer_fuzzy_find theme=get_ivy

this is using layout_strategy = "bottom_pane",

Screenshot from 2022-05-01 19-49-31


    sorting_strategy = "ascending",

    layout_strategy = "bottom_pane",
    layout_config = {
      height = 8,
    },

    border = true,
        borderchars = lvim.builtin.telescope.defaults.borderchars,
        previewer = false,
        shorten_path = false,