feat: quickfix/locationlist extension(#248)

This commit is contained in:
Alejandro Sanchez 2021-05-19 22:36:55 +02:00 committed by GitHub
parent 2c2876ae0c
commit 2f0f1fc49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -1,14 +1,26 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function quickfix() return 'Quickfix List' end
--
local function is_loclist()
return vim.fn.getloclist(0, {filewinid = 1}).filewinid ~= 0
end
local function quickfix_title() return vim.fn.getqflist({title = 0}).title end
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
local M = {}
M.sections = {
lualine_a = {quickfix},
lualine_b = {quickfix_title},
lualine_a = {label},
lualine_b = {title},
lualine_z = {'location'}
}