fix: invalid reference to fn

This commit is contained in:
Olivier Roques
2022-01-27 18:43:54 +01:00
parent 0913699777
commit 642d6f3314
2 changed files with 10 additions and 12 deletions

View File

@@ -95,7 +95,7 @@ local function load_sections(sections)
item = load_section(section.item),
}
end
common.echo('WarningMsg', 'Invalid section.')
common.echo('Invalid section', 'WarningMsg')
return ''
end
return vim.tbl_map(load_section, sections)
@@ -103,7 +103,7 @@ end
local function remove_hidden_sections(sections)
local filter = function(section)
return not section.hide or section.hide <= fn.winwidth(0)
return not section.hide or section.hide <= vim.fn.winwidth(0)
end
return vim.tbl_filter(filter, sections)
end

View File

@@ -1,5 +1,3 @@
local cmd, fn = vim.cmd, vim.fn
local g = vim.g
local fmt = string.format
local M = {}
@@ -18,17 +16,17 @@ M.modes = {
['t'] = {text = 'TERMINAL', state = 'command'},
}
function M.echo(hlgroup, msg)
cmd(fmt('echohl %s', hlgroup))
cmd(fmt('echo "[hardline] %s"', msg))
cmd('echohl None')
function M.echo(msg, hlgroup)
vim.api.nvim_echo({{fmt('[hardline] %s', msg), hlgroup}}, false, {})
end
function M.set_cache_autocmds(augroup)
cmd(fmt('augroup %s', augroup))
cmd('autocmd!')
cmd(fmt('autocmd CursorHold,BufWritePost * unlet! b:%s', augroup))
cmd('augroup END')
vim.cmd(fmt([[
augroup %s
autocmd!
autocmd CursorHold,BufWritePost * unlet! b:%s
augroup END
]], augroup, augroup))
end
return M