How does someone create a symlink in pure VimScript?
1 Answers
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.

- 13,674
- 1
- 18
- 27