Skip to content

Commit 7751b6e

Browse files
committed
fix: detach bqf if invalid (#138)
1 parent 4d786b9 commit 7751b6e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lua/bqf/main.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function M.enable()
4747
au WinEnter <buffer> ++nested lua require('bqf.main').enterQf()
4848
au WinClosed <buffer> ++nested lua require('bqf.main').closeQf()
4949
au WinLeave <buffer> lua require('bqf.main').saveWinView()
50+
au BufEnter <buffer> lua require('bqf.main').validBuf()
5051
aug END
5152
]])
5253
-- TODO
@@ -103,6 +104,12 @@ function M.saveWinView()
103104
qfs:saveWinView(winid)
104105
end
105106

107+
function M.validBuf()
108+
if not vim.w.bqf_enabled and not qfs:get(api.nvim_get_current_win()) then
109+
M.disable()
110+
end
111+
end
112+
106113
function M.enterQf()
107114
local winid = api.nvim_get_current_win()
108115
local qs = qfs:get(winid)

0 commit comments

Comments
 (0)