From 1480ffe2014b4f04ab98100d273c23a3bae091eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Lepage?= <33058747+GaetanLepage@users.noreply.github.com> Date: Sat, 21 Jan 2023 18:04:28 +0100 Subject: [PATCH] plugins/utils/nvim-tree: change implementation of autoClose (#125) --- 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 3e2d93c5..ecc9616a 100644 --- a/plugins/utils/nvim-tree.nix +++ b/plugins/utils/nvim-tree.nix @@ -223,7 +223,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; @@ -267,6 +266,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}) '';