From 7a354187cb99519e7e26f3e445c18530beacd7ff Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 16 Jan 2023 10:23:17 +0100 Subject: [PATCH] plugins/utils/nvim-tree: change implementation of autoClose --- plugins/utils/nvim-tree.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/utils/nvim-tree.nix b/plugins/utils/nvim-tree.nix index 351f49ba..f15afa8d 100644 --- a/plugins/utils/nvim-tree.nix +++ b/plugins/utils/nvim-tree.nix @@ -217,7 +217,6 @@ in hijack_netrw = cfg.hijackNetrw; open_on_setup = cfg.openOnSetup; ignore_ft_on_setup = cfg.ignoreFtOnSetup; - auto_close = cfg.autoClose; open_on_tab = cfg.openOnTab; hijack_cursor = cfg.hijackCursor; update_cwd = cfg.updateCwd; @@ -261,6 +260,14 @@ in nvim-web-devicons ]; + autoCmd = mkIf cfg.autoClose [ + { + event = "BufEnter"; + command = "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"; + nested = true; + } + ]; + extraConfigLua = '' require('nvim-tree').setup(${helpers.toLuaObject options}) '';