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