Skip to content

Conversation

@MrBanh
Copy link
Contributor

@MrBanh MrBanh commented Jan 7, 2026

The default snacks picker layout is used for various sources that is not always ideal for this plugin's use case. E.g., many layouts have preview = 'file', which is useless for the session_picker. There's no way to disable preview just for Opencode's snacks picker without affecting other uses of snacks picker for other sources. Looks like it's because of this change

For example,

{
  "folke/snacks.nvim",
  opts = {
    picker = {
      layout = { preset = "ivy" }
    }
  }
}

The ivy preset has a preview window that doesn't work with session_picker, but I don't want to disable it because the default picker layout is used for a bunch of builtin sources where I rely on the file preview.

Screenshot from 2026-01-07 04-24-49

This change allows users to specify a layout in the config. I only added the option for snacks, but we can extend it to the other pickers as well.

There's 3 main ways on how to change the snacks picker layout

  1. Don't specify the new options -> it'll just default to the user's snack picker layout preset

  2. Specify the new options for opencode, e.g.

    require("opencode").setup({
      ui = {
        picker = {
          snacks_layout = {
            layout = { border = "none", box = "vertical", ... }
          },
        },
      },
    })
  3. Specify a preset available for snacks picker OR a custom layout

    -- opencode.lua
    require("opencode").setup({
      ui = {
        picker = {
          snacks_layout = {
            preset = "custom_layout" -- or builtin snacks, like "select", "default", etc
          },
        },
      },
    })    
    -- snacks.lua
    { 
      "folke/snacks.nvim",
      opts = {
        picker = {  
          layouts = {  
            custom_layout  = {
              layout = { border = "none", box = "vertical", ... }
              -- ...
    }

MrBanh added 3 commits January 7, 2026 04:12
The default snacks picker layout is used for various sources that is not
always ideal for this plugin's use case. E.g., many layouts have preview
= 'file', which is useless for the session_picker. There's no way to
disable preview just for Opencode's snacks picker without affecting
other uses of snacks picker for other sources.
@sudo-tee
Copy link
Owner

sudo-tee commented Jan 8, 2026

This is a good idea, the implementation seem reasonable also

Thanks for the PR

@sudo-tee sudo-tee merged commit 57c0087 into sudo-tee:main Jan 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants