Skip to content

How can a preset be extended/overriden #1319

Answered by tigion
Muizzyranking asked this question in Q&A
Discussion options

You must be logged in to vote

In the opts.picker.layouts table, you can overwrite or define your own layout presets. The specified name can then be used.

I have created three telescope-like layouts my_telescope, my_telescope_vertical, and my_telescope_vertical_no_preview and use them depending on the window size in opts.picker.layout as default. In opts.picker.sources you can. set the layout per picker or in the picker call directly snacks.picker.files({layout = { preset = 'my_telescope' }}).

  opts = {
    picker = {
      -- The default layout preset.
      layout = function()
        return vim.o.columns >= 120 and 'my_telescope'
          or vim.o.lines >= 25 and 'my_telescope_vertical'
          or 'my_telescope_…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Muizzyranking
Comment options

@Muizzyranking
Comment options

Answer selected by Muizzyranking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants