Vim 9.0 is Here With a New Script Language Promising Performance Boost

Vim 9.0 is Here With a New Script Language Promising Performance Boost

Vim, the terminal text editor is back with a major update.

The Vim 9.0 release includes several tiny improvements along with a new script language (Vim9 script).

Here, let me highlight the key changes.

Vim 9.0: What’s New?

Vim 9.0 is a significant upgrade after almost three years. And, the release announcement mentions that Vim 9.0 is more reliable than any before, which is a good thing to hear.

Some of the refinements include:

A New Vim9 Script

Vim script always ensures backwards compatibility, but that changes a bit with this update.

The backwards compatibility always comes with slower execution performance. So, with the Vim9 script, they aim to drastically improve performance.

The release note explains:

This is accomplished by compiling commands into instructions that can be efficiently executed. An increase in execution speed of 10 to 100 times can be expected.

Sounds incredible, isn’t it?

However, what’s the catch for these performance improvements? Here’s what they say:

The performance improvements can only be achieved by not being 100% backwards compatible. For example, making function arguments available by creating an “a:” dictionary involves quite a lot of overhead. In a Vim9 function this dictionary is not available. Other differences are more subtle, such as how errors are handled.

So, you no longer get 100% backwards compatibility, but the legacy scripts should work as usual.

In addition to the performance improvements, the new script language also aims to get closer to commonly used programming languages, including JavaScript, TypeScript, and Java.

The developers also plan to add support for classes in the script language.

You can learn more about the new script in the official help page.

New Features

You will also find some technical feature additions like:

  • Function must be defined with def, if you want to benefit from the speedup.
  • The arguments and return types must be specificed.
  • Line continuation does not require using a backlash.
  • It now simpler to split large scripts. You can use export to make functions/variables available to other scripts, and import to use exported items.
  • Comments now start with # replacing double quote syntax.

In either case, you can always refer to the official announcement to explore all the technical details with the update.

Download Vim 9.0

If you are going to try Vim for the first, you might want to check out our Vim vs Nano comparison article (keeping in mind the changes for this release).

You can download the latest version directly from the official website. Packages should be available for Debian-based/Ubuntu-based systems. For other Linux distributions, you might want to explore the documentations.

You can build it from sources and apply the latest patches as well.