forked from Davidyz/VectorCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlualine.lua
More file actions
34 lines (33 loc) · 983 Bytes
/
Copy pathlualine.lua
File metadata and controls
34 lines (33 loc) · 983 Bytes
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
local vc_config = require("vectorcode.config")
---@param opts {show_job_count: boolean}?
return function(opts)
opts = vim.tbl_deep_extend("force", { show_job_count = false }, opts or {})
local cacher = vc_config.get_cacher_backend()
return {
function()
local message = "VectorCode: "
if cacher.buf_is_enabled(0) then
local retrieval = cacher.query_from_cache(0, { notify = false })
if retrieval then
message = message .. tostring(#retrieval)
end
local job_count = cacher.buf_job_count(0)
if job_count > 0 then
if opts.show_job_count then
message = message .. (" (%d) "):format(job_count)
else
message = message .. " "
end
else
message = message .. " "
end
else
message = message .. " "
end
return message
end,
cond = function()
return cacher.buf_is_registered()
end,
}
end