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), item = load_section(section.item),
} }
end end
common.echo('WarningMsg', 'Invalid section.') common.echo('Invalid section', 'WarningMsg')
return '' return ''
end end
return vim.tbl_map(load_section, sections) return vim.tbl_map(load_section, sections)
@@ -103,7 +103,7 @@ end
local function remove_hidden_sections(sections) local function remove_hidden_sections(sections)
local filter = function(section) 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 end
return vim.tbl_filter(filter, sections) return vim.tbl_filter(filter, sections)
end end

View File

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