mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(explorer): keep expanded dir state. Closes #816
This commit is contained in:
parent
cd61c235a5
commit
31984e88a5
1 changed files with 3 additions and 1 deletions
|
@ -6,6 +6,7 @@ local M = {}
|
|||
---@type table<snacks.Picker, snacks.picker.explorer.State>
|
||||
M._state = setmetatable({}, { __mode = "k" })
|
||||
local uv = vim.uv or vim.loop
|
||||
local expanded = {} ---@type table<string, boolean>
|
||||
|
||||
---@class snacks.picker.explorer.Item: snacks.picker.finder.Item
|
||||
---@field file string
|
||||
|
@ -32,7 +33,8 @@ function State.new(picker)
|
|||
self.picker = picker:ref()
|
||||
local filter = picker:filter()
|
||||
self.cwd = filter.cwd
|
||||
self.expanded = { [self.cwd] = true }
|
||||
self.expanded = expanded
|
||||
self.expanded[self.cwd] = true
|
||||
local buf = vim.api.nvim_win_get_buf(picker.main)
|
||||
local buf_file = vim.fs.normalize(vim.api.nvim_buf_get_name(buf))
|
||||
if uv.fs_stat(buf_file) then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue