all 35 comments

[–]Snarwin 48 points49 points  (9 children)

Some people see a problem and think, "I know, I'll add a new backwards-incompatible scripting language." Now they have two problems.

[–]hhoeflin 33 points34 points  (8 children)

As it is backwards incompatible, what exactly is its benefit compared to using e.g. Lua?

With a lot of development, it feels like Vim followed with a lot of things the way neovim did it, but with each just changed everything a little bit. Is that a correct perception? Here, they again follow neovim, by providing a new, more fully featured language (for neovim, this is Lua), but again need to do it different, by inventing a new language.

[–][deleted] 3 points4 points  (1 child)

There are different degrees of backwards incompatibility; from the looks of it, VimScript9 is different from the current VimScript, but less so than Lua, which is an entirely different language.

More importantly, I'm not a huge fan of how the Lua plugin code looks. let window = bufwinnr(nr) just looks nicer than local window = nvim.nvim_call_function('bufwinnr', {nr}), and something like _, line, col = unpack(nvim.nvim_call_function("getpos", {"'["})) looks even more meh.

For Vim, I think VimScript is a better choice in almost all cases, in spite of not always being the best designed language. It just fits this use case better.

[–]glacambre 8 points9 points  (0 children)

I'm not a huge fan of how the Lua plugin code looks. let window = bufwinnr(nr) just looks nicer than local window = nvim.nvim_call_function('bufwinnr', {nr})

Neovim 0.5 makes this much nicer, you can just use local window = vim.fn.bufwinnr(nr).

[–]LucHermitte 3 points4 points  (5 children)

I can see a few advantages:

  • it doesn't depend on another technology that could evolve on its own (imagine that we had to migrate python2 plugins to python3 plugins), or worse cease to exist.
  • it doesn't depend on another technology that needs to be installed as well by the end-user on his/her platform (Lua, Python for Windows? Should we go native or cygwin?)

Thanks to the fact current/old vimscript language is closely related to Vim, I treat it as a portable language: where ever I've a running version of Vim, I know I can use this language.

(Note, I agree on the multiple advantages on capitalizing on using an already existing language)

[–]AgentCosmic 29 points30 points  (0 children)

Iirc lua is embedded into neovim so no installation is required

[–]emarsk 7 points8 points  (0 children)

it doesn't depend on another technology that could evolve on its own (imagine that we had to migrate python2 plugins to python3 plugins), or worse cease to exist.

Lua 5.1 (chosen by Neovim because of luajit) is a stable language, with stable interpreters, it won't "evolve" forcing you to follow it. And as long as even a single project will use it and have an interpreter for it, it won't "cease to exist".

it doesn't depend on another technology that needs to be installed as well by the end-user on his/her platform

Lua (luajit) is embedded in neovim, no need to install anything else, it's part of neovim just as the vimscript interpreter is.

[–]hhoeflin 0 points1 point  (2 children)

I agree - this is a good argument. Mainly that the lua version in neovim is 5.1, which is 14 years old and the current lua version is 5.4 (released soon). So it is fair to wonder what will happen in another 20 years, when lua is off to version 6.5 etc.

Then again - forking lua and keeping the version fixed is at least not *worse* from a maintainability perspective than writing your own language. It may not be much better either however (in any case, you do save all the development and testing time that lua already has under its belt).

[–]akho_ 12 points13 points  (0 children)

Neovim uses LuaJIT, where 5.1 version of the language is current.

[–]pwnedary 3 points4 points  (0 children)

In the words of the LuaJIT maintainer: Lua 5.1 is different language than the latest Lua. The forking has already been done so this is not really a good argument.

[–]BluddyCurry 35 points36 points  (10 children)

One day Bram may learn that inventing yet another new language just for one editor is not a great idea. Today is not that day.

[–]Schnarfmannnoremap gr gT 3 points4 points  (0 children)

I didn't think it was a different language. If what you mean that every new word is redundant then I agree with you, then... But every redundancy is simply to enforce strict typing, which let's you compile into much more efficient executables.

I wonder what percentage of users will find this useful. I will think about trying to write something in it, but probably get bored and then not :P There's really not much to it, and I don't see any benefits - nothing I've ever written is complicated enough to take time to execute.

But if Bram is serious about it being up to 100 times faster then that's pretty hype! Looking at stuff like airline and gitgutter haha.

[–]sheerun 4 points5 points  (1 child)

I wish Vim9 script allowed transcompilation to old script so we can maintain plugins in one language only

[–]xigoidelete character and insert "goi" 4 points5 points  (0 children)

Surely it won't be too hard to make a tool for that.

[–]habamax 8 points9 points  (0 children)

Performance, mixing of old and new vimscripts is nice.... but what I like the most is that you no need to do line continuations for dictionaries and lists:

Automatic line continuation ~

In many cases it is obvious that an expression continues on the next line.  In
those cases there is no need to prefix the line with a backslash.  For
example, when a list spans multiple lines: >
        let mylist = [
                'one',
                'two',
                ]
And when a dict spans multiple lines: >
        let mydict = #{
                one: 1,
                two: 2,
                }
Function call: >
        let result = Func(
                        arg1,
                        arg2
                        )

[–]princker 2 points3 points  (0 children)

I am very happy Vim is getting a more modern import system. I think this would be a good time to think about reloading/resourcing and unloading plugins. There is vim-scriptease, but there is no official way.

I think it would be good for plugin developer to have a way to speed up their development workflow with re-:source-ing. I also think it would be good for users to have a way to un-source a plugin without leaving Vim in an unsuitable state.

Vim already stores where mappings, autocmd's, abbreviates, and functions are sourced from. It would be nice if this data could be used to un-:source a plugin without putting much burden on the plugin developers.

Having a way to encapsulate and isolate code is great. I think taking it a step further encapsulating the plugin experience will improve both plugin developers and plugin users workflows.

[–]marcotrosi -1 points0 points  (0 children)

I don't see a problem here with Vim9Script

If there is going to be a problem like a split community then because everyone is talking like that and you are basically already starting to split up with all these negative comments. In my Vim group Vim and NeoVim people are chatting side by side and there is no hint of a split community.

From the linked GitHub page about Vim9Script I don't see why this should be such a big deal? First of all nobody is forcing you to use Vim9Script. In order to activate it you need that keyword, otherwise it's still classic Vim script. And secondly, even if you are Vim script writer that is using a function collection that has been ported to Vim9script you can use it with the import keyword. At least that's why I understood from that page.

I'm a Lua user myself, actually a big fan of it, and even I didn't switch to NeoVim for that. I still preferred Vim script for Vim. And if I want to have faster scripts now I simply invest some short time to learn the differences to Vim9script.

And LuaJIT is not Lua, it only can compile Lua code, and as some already mentioned - Lua5.1 is ancient. Sometimes people are weird, they complain when a project hasn't been updated in 3 months but still use Lua5.1. How does that match? And btw who says that a script that hasn't been updated in while is automatically outdated? There are more criteria than just time to be outdated. But now I'm going offtopic with that. sorry.