Skip to content

Commit a1b2e7d

Browse files
committed
fix: nvim -q
1 parent b17a3e6 commit a1b2e7d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lua/flatten/core.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ function M.edit_files(opts)
212212
}
213213
end
214214

215-
if quickfix then
216-
vim.fn.setqflist(quickfix, "r")
215+
if quickfix and #quickfix ~= 0 then
216+
vim.fn.setqflist(quickfix, " ")
217+
return false
217218
end
218219

219220
---@type Flatten.WindowId

lua/flatten/guest.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,10 @@ function M.init(host_pipe)
144144
:totable()
145145
nfiles = #files
146146

147-
local quickfix = vim.iter(vim.api.nvim_list_bufs()):find(function(buf)
148-
return vim.bo[buf].filetype == "quickfix"
149-
end)
150-
147+
local quickfix = vim.fn.getqflist()
151148
-- No arguments, user is probably opening a nested session intentionally
152149
-- Or only piping input from stdin
153-
if nfiles < 1 and not quickfix then
150+
if nfiles < 1 and #quickfix == 0 then
154151
local should_nest, should_block = config.nest_if_no_args, false
155152

156153
if config.hooks.no_files then
@@ -179,7 +176,7 @@ function M.init(host_pipe)
179176
end
180177

181178
quickfix = vim
182-
.iter(vim.fn.getqflist())
179+
.iter(quickfix)
183180
:map(function(old)
184181
return {
185182
filename = vim.api.nvim_buf_get_name(old.bufnr),

0 commit comments

Comments
 (0)