From a32407d13241c73e9ab918fa1ecb542958a72d33 Mon Sep 17 00:00:00 2001 From: Joshua Yin <56745535+Subjective@users.noreply.github.com> Date: Fri, 15 Sep 2023 12:08:29 -0700 Subject: [PATCH] feat(config): add option to disable auto_close --- README.md | 4 ++++ lua/bqf/config.lua | 1 + lua/bqf/main.lua | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0803159..ec61fb0 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,10 @@ Using external grep-like program to search `display` and replace it to `show`, b description = [[Enable nvim-bqf in quickfix window automatically]], default = true }, + auto_close = { + description = [[Automatically close nvim-bqf if it is the only window, replacing it with an empty buffer]] + default = true + } magic_window = { description = [[Give the window magic, when the window is splited horizontally, keep the distance between the current line and the top/bottom border of neovim unchanged. diff --git a/lua/bqf/config.lua b/lua/bqf/config.lua index 110eb57..2d56f95 100644 --- a/lua/bqf/config.lua +++ b/lua/bqf/config.lua @@ -7,6 +7,7 @@ ---@field filter BqfConfigFilter local def = { auto_enable = true, + auto_close = true, magic_window = true, auto_resize_height = false, previous_winid_ft_skip = {}, diff --git a/lua/bqf/main.lua b/lua/bqf/main.lua index a74eb39..f1b1c77 100644 --- a/lua/bqf/main.lua +++ b/lua/bqf/main.lua @@ -44,7 +44,7 @@ function M.enable() cmd([[ aug Bqf au! * - au WinEnter ++nested lua require('bqf.main').killAloneQf() + au WinEnter ++nested lua if require('bqf.config').auto_close then require('bqf.main').killAloneQf() end au WinClosed ++nested lua require('bqf.main').closeQf() au WinLeave lua require('bqf.main').saveWinView() aug END