-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathquickfix.lua
41 lines (35 loc) · 866 Bytes
/
quickfix.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local M = {}
M.on_save = function()
return vim.tbl_map(function(item)
return {
filename = item.bufnr and vim.api.nvim_buf_get_name(item.bufnr),
module = item.module,
lnum = item.lnum,
end_lnum = item.end_lnum,
col = item.col,
end_col = item.end_col,
vcol = item.vcol,
nr = item.nr,
pattern = item.pattern,
text = item.text,
type = item.type,
valid = item.valid,
}
end, vim.fn.getqflist())
end
M.on_pre_load = function(data)
vim.fn.setqflist(data)
end
M.is_win_supported = function(winid, bufnr)
return vim.bo[bufnr].buftype == "quickfix"
end
M.save_win = function(winid)
return {}
end
M.load_win = function(winid, config)
vim.api.nvim_set_current_win(winid)
vim.cmd("copen")
vim.api.nvim_win_close(winid, true)
return vim.api.nvim_get_current_win()
end
return M