测试Neovim是否在LUA中使用文件打开
我正在lua中为neovim创建一个插件,我只想在neovim时做一定的事情 在没有打开文件的情况下打开
,例如,如果我使用nvim file.txt
调用neovim,则代码应执行,因为我正在打开文件。但是,如果我运行nvim
,则不应执行。
提前致谢
I'm creating a plugin for NeoVim in Lua, and I only want to do a certain thing if NeoVim
was opened without opening a file
So for example, if I invoke NeoVim with nvim file.txt
, the code should execute, because I'm opening a file. However, if I ran nvim
, it should not execute.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Neovim具有一个内置函数
argv()
,该功能返回传递给Neovim的文件列表。更多信息:
:H argv()
neovim has a builtin function
argv()
which returns a list of files passed to neovim.more info:
:h argv()