【发布时间】:2022-10-21 00:15:39
【问题描述】:
我正在尝试将一些旧的 vimscript 迁移到 lua。我有一堆“散文”设置,现在在 .config/nvim/plugin/functions.lua 中有这些设置:
function prose()
vim.o.fdo:append('search')
vim.bo.virtualedit = block
-- more commands
end
然后在 prose.lua 中:
local textedit = vim.api.nvim_create_augroup('textedit', {clear = true})
vim.api.nvim_create_autocmd({"BufEnter", "BufNew"}, {
group = "textedit",
pattern = {"*.adoc", "*.md", "*.tex"},
callback = "prose",
})
vim.api.nvim_create_user_command(
'Prose',
"call prose()",
{nargs = 0, desc = 'Apply prose settings'}
)````
But either the autocommand on opening an .adoc file or running :Prose on the command line will return:
````E117: Unknown function: prose````
How can I make my 'prose' function available?
【问题讨论】: