2021-05-11 19:22:58 +00:00
|
|
|
-- Copyright (c) 2020-2021 hoob3rt
|
|
|
|
-- MIT license, see LICENSE for more details.
|
2021-05-19 20:36:55 +00:00
|
|
|
--
|
|
|
|
local function is_loclist()
|
|
|
|
return vim.fn.getloclist(0, {filewinid = 1}).filewinid ~= 0
|
|
|
|
end
|
2021-05-11 19:22:58 +00:00
|
|
|
|
2021-05-19 20:36:55 +00:00
|
|
|
local function label()
|
|
|
|
return is_loclist() and 'Location List' or 'Quickfix List'
|
|
|
|
end
|
|
|
|
|
|
|
|
local function title()
|
|
|
|
if is_loclist() then
|
|
|
|
return vim.fn.getloclist(0, {title = 0}).title
|
|
|
|
end
|
|
|
|
return vim.fn.getqflist({title = 0}).title
|
|
|
|
end
|
2021-08-26 19:01:42 +00:00
|
|
|
local empty = {function() return ' ' end, left_padding=0, right_padding=0}
|
2021-05-11 19:22:58 +00:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
2021-08-13 01:20:56 +00:00
|
|
|
function M.init()
|
|
|
|
-- Make sure ft wf doesn't create a custom statusline
|
|
|
|
vim.g.qf_disable_statusline = true
|
|
|
|
end
|
|
|
|
|
2021-05-11 19:22:58 +00:00
|
|
|
M.sections = {
|
2021-05-19 20:36:55 +00:00
|
|
|
lualine_a = {label},
|
|
|
|
lualine_b = {title},
|
2021-08-26 19:01:42 +00:00
|
|
|
lualine_c = {empty},
|
2021-05-11 19:22:58 +00:00
|
|
|
lualine_z = {'location'}
|
|
|
|
}
|
|
|
|
|
|
|
|
M.filetypes = {'qf'}
|
|
|
|
|
|
|
|
return M
|