您如何在纯Vimscript中创建符号链接?

发布于 2025-02-06 16:47:09 字数 30 浏览 1 评论 0原文

某人如何在纯Vimscript中创建符号链接?

How does someone create a symlink in pure VimScript?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉世弥音 2025-02-13 16:47:09

VIM应该是编辑器,而不是外壳或通用编程平台。因此,其“文件系统” -API非常有限(考虑到某些功能在许多不同的OSS之间也可能无法运行)。因此,当您需要外壳时,只需调用它

:!ln -s ~/foo ~/bar
:"or like this
:call system('ln -s ~/foo ~/bar')

,这是“纯Vimscript”,只是它取决于外部工具并且慢。

在Neovim,还有Lua Engine的内置。当然,lua与vimscript不同,但是它已经存在,也可以从vimscript调用。而且,如果您缺少一些功能,则可以使用以通用编程语言编写的二进制模块(IE动态库)进行扩展,例如C。

当然,VIM中还有其他一些“语言接口”不想加载整个Python发动机只是为了避免单个壳调用。

Vim is supposed to be an editor, not a shell or general purpose programming platform. Therefore its "filesystem"-API is quite limited (consider that some features may be even non-portable between many different OSes Vim may run on). So when you need shell just invoke it

:!ln -s ~/foo ~/bar
:"or like this
:call system('ln -s ~/foo ~/bar')

And this is "pure VimScript" except it depends on external tool and is slow.

In Neovim there's also Lua engine builtin. Sure, Lua is different from VimScript, but it's already there and could be invoked from VimScript too. And in case you're missing some functionality, you can extend it with binary modules (i.e. dynamic libraries) written in general purpose programming language, such as C.

Of course, there are also some other "language interfaces" in Vim but you probably don't want to load the whole Python engine only to avoid a single shell call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文