[Neotree] Fix file watcher

This commit is contained in:
Admin 2025-04-10 18:45:39 +02:00
parent c396441544
commit 3e6fae6379

View File

@ -9,25 +9,6 @@ return {
lazy = false, -- neo-tree will lazily load itself lazy = false, -- neo-tree will lazily load itself
config = function() config = function()
-- Automatically open up -- Automatically open up
local function toggle_single_item_folders()
local nodes = require("neo-tree.sources.filesystem").get_nodes()
for _, node in ipairs(nodes) do
-- Check if the node is a directory
if node.type == "directory" then
local children = node:get_children()
if #children == 1 then
-- If it only has one child, make the folder appear stacked
node.collapsed = false -- Open the directory automatically
else
node.collapsed = true -- Keep multi-item directories collapsed
end
end
end
-- Refresh Neotree to reflect changes
require("neo-tree").refresh()
end
require("neo-tree").setup({ require("neo-tree").setup({
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded", popup_border_style = "rounded",
@ -231,7 +212,7 @@ return {
-- "open_current", -- netrw disabled, opening a directory opens within the -- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position -- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events. -- instead of relying on nvim autocmd events.
window = { window = {
mappings = { mappings = {