1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 00:00:04 +08:00

fix(lua): fix lua warnings

This commit is contained in:
Eric Wong 2024-06-12 19:45:53 +08:00
parent 6b653dbf86
commit 7edc45e572
2 changed files with 9 additions and 18 deletions

View File

@ -25,6 +25,7 @@ end
if fn.exists('*json_decode') then
---@return table | string
function M.json_decode(json)
if json == '' then
return ''

View File

@ -366,18 +366,6 @@ local registed_sections = {
['search count'] = search_count,
}
local function check_mode()
if vim.fn.mode() == 'n' then
return 'n'
elseif vim.fn.mode() == 'i' then
return 'i'
elseif string.match(vim.fn.mode(), 'v') then
return 'v'
elseif string.match(vim.fn.mode(), 'R') then
return 'R'
end
end
local function current_tag()
return '%{ v:lua.require("spacevim.plugin.statusline")._current_tag() }'
end
@ -957,7 +945,7 @@ function M.config()
'toggle the statusline itself',
1
)
local function TagbarStatusline(in_tagbar, sortstr, fname, flags)
local function TagbarStatusline(_, _, fname, _)
local name = ''
if vim.fn.strwidth(fname) > vim.g.spacevim_sidebar_width - 15 then
name = string.sub(fname, vim.g.spacevim_sidebar_width - 20) .. '..'
@ -995,6 +983,7 @@ function M.config()
''
)
)
if type(conf) == 'table' then
for k, v in pairs(conf) do
if v == 1 or v == true then
log.debug('cached major mode: ' .. k)
@ -1002,8 +991,9 @@ function M.config()
end
end
end
end
end
function M.ctrlp(focus, byfname, regex, prev, item, next, marked)
function M.ctrlp(focus, byfname, _, prev, item, next, _)
return statusline.build(
{ ' Ctrlp ', ' ' .. prev .. ' ', ' ' .. item .. ' ', ' ' .. next .. ' ' },
{ ' ' .. focus .. ' ', ' ' .. byfname .. ' ', ' ' .. vim.fn.getcwd() .. ' ' },