在 NeoVim init.lua 中设置 Vim 插件选项
我想设置具有vimscript格式的VIM插件选项,让我的neovim
File,我无法弄清楚如何设置这些选项的格式是新近尊重的。init.lua
files in neovim
我已经尝试使用vim.cmd(“让某些#选项=选项”)
,但这似乎不起作用。有建议吗?谢谢!
I want to set vim plugin options that have the vimscript format let some#option = option
inside my NeoVim init.lua
file, but I can't figure out how to set these options in a format that NeoVim respects.
I've tried using vim.cmd("let some#option = option")
but this doesn't seem to work. Any advice? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 nanotee/nvim-lua-guide,关于 管理vim内部变量显示各种API调用,包括
g:
):vim.api.nvim_set_var()
vim.api.nvim_get_var()
vim.api.nvim_del_var()
在实践中,设置全局变量看起来像
您也可以使用 元访问器,例如
vim.g
:使用
vmd.cmd 可以工作,尽管使用了 more建议使用上面所示的结构化 API。
请注意,在
vim.cmd("let some#option = option")
中,赋值运算符的右侧是一个表达式。这意味着普通令牌option
将被评估为标识符。根据您想要执行的操作,您可能需要添加其他引号来创建字符串。
From nanotee/nvim-lua-guide, the section on Managing vim internal variables shows various API calls, including
g:
):vim.api.nvim_set_var()
vim.api.nvim_get_var()
vim.api.nvim_del_var()
In practice, setting a global variable looks like
You can also use the meta-accessors, such as
vim.g
:The method with
vmd.cmd
can work, although using the more structured API shown above is advised.Note that in
vim.cmd("let some#option = option")
the right-hand side of the assignment operator is an expression. This means the plain tokenoption
would be evaluated as an identifier.Depending on what you are trying to do, you may need to add additional quotes to create a string.