I can't seem to use explorer layout when I set a general layout config in the pickers config #1448
Replies: 3 comments 9 replies
-
I'll give you a lazy answer. Try to find a proper structure here: https://github.com/drowning-cat/nvim/blob/main/lua/plugins/snacks.lua |
Beta Was this translation helpful? Give feedback.
-
that is similar to what i already have, just broke stuff up for simplicity. here is snacks config local dashboard_opts = require("snacks_settings/dashboard")
local picker_opts = require("snacks_settings/picker_opts")
local snacks_keys = require("snacks_settings/keys")
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
-- other config
explorer = {
enabled = true,
replace_netr = true,
},
picker = picker_opts,
},
} pickers config local files_picker = require("snacks_settings.files_picker")
local explorer_picker = require("snacks_settings.explorer_picker")
local projects_picker = require("snacks_settings.projects_picker")
local picker_opts = {
enabled = true,
layout = {
layout = {
preset = "default",
cycle = true,
--- Use the default layout or vertical if the window is too narrow
-- preset = function()
-- return vim.o.columns >= 120 and "default" or "vertical"
-- end,
box = "horizontal",
width = 0.8,
min_width = 120,
height = 0.8,
{
box = "vertical",
border = "rounded",
title = "{title} {live} {flags}",
{ win = "input", height = 1, border = "bottom" },
{ win = "list", border = "none" },
},
{ win = "preview", title = "{preview}", border = "rounded", width = 0.7 },
},
},
sources = {
projects = projects_picker,
files = files_picker,
explorer = explorer_picker,
},
}
return picker_opts
explorer config local explorer_picker = {
layout = { preset = "sidebar", preview = false, cycle = false },
finder = "explorer",
-- other stuff
}
return explorer_picker |
Beta Was this translation helpful? Give feedback.
-
Actually scratch everything I just wrote. I just want to increase the width of the preview window of 'telescope' layout. That is all I want. I didn't think there were different layout defaults for different pickers (that is what I understood from your earlier reply). I thought if change the root default preview width, then I am set. how to change telescope window preview from 0.5 to something else? Oh my god, I should have started with this. Apologize |
Beta Was this translation helpful? Give feedback.
-
What I am trying to do is set general layout config for pickers, and let explorer use a different one.
The general config works as it should, however, the explorer is not using its specific layout config. instead it is using the general/common layout config. It should have been using its own layout config with the
preset="sidebar"
; instead it behaves as the other pickers. Am I doing something wrong here?here is the general layout config
Here is the explorer config
Beta Was this translation helpful? Give feedback.
All reactions