fix(qf): update quickfixtextfunc
This commit is contained in:
@@ -80,7 +80,7 @@ vim.opt.statusline = "%{expand('%:.')} %{%v:lua.require('git').status()%} %3(%m%
|
||||
.. " %{&filetype} %{&fileencoding} %{&fileformat}"
|
||||
.. " %4(%p%%%) %4l:%-3v"
|
||||
|
||||
function _G._quickfix_text_func(info)
|
||||
function _G.quickfix_text_func(info)
|
||||
local items
|
||||
if info.quickfix == 1 then
|
||||
items = vim.fn.getqflist({ id = info.id, items = 1 }).items
|
||||
@@ -97,7 +97,7 @@ function _G._quickfix_text_func(info)
|
||||
if item.bufnr ~= 0 then
|
||||
name = vim.fn.fnamemodify(vim.fn.bufname(item.bufnr), ":.")
|
||||
end
|
||||
if vim.fn.strchars(name) == 0 then
|
||||
if name == "" then
|
||||
name = " "
|
||||
end
|
||||
line = line .. name
|
||||
@@ -110,20 +110,17 @@ function _G._quickfix_text_func(info)
|
||||
line = line .. ": "
|
||||
end
|
||||
|
||||
line = line .. item.text
|
||||
line = line
|
||||
.. (item.text:gsub("^%s*(.-)%s*$", "%1"):gsub("%s*\n%s*", "\n "))
|
||||
table.insert(lines, line)
|
||||
end
|
||||
|
||||
return lines
|
||||
end
|
||||
|
||||
vim.opt.quickfixtextfunc = "v:lua.quickfix_text_func"
|
||||
|
||||
vim.cmd([[
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
|
||||
function! QuickfixTextFunc(info) abort
|
||||
return v:lua._quickfix_text_func(a:info)
|
||||
endfunction
|
||||
|
||||
set quickfixtextfunc=QuickfixTextFunc
|
||||
]])
|
||||
|
||||
Reference in New Issue
Block a user