Vim 9 Updates Script Language
Written by Ian Elliot   
Thursday, 07 July 2022

There's a major new release of Vim, the popular text editor, with a major new version of the Vim script language, Vim9 script, along with a wide range of more minor improvements.

Vim is a command-based text editor based on the Unix vi editor. It aims to provide the power of vi with a more complete feature set. Many developers prefer the simplicity of a text editor configured to your personal setup, claiming to be faster coding in such an environment as opposed to modern bloatware IDEs.

vimlogo

The headline change in Vim9 is the new script language.The Vim team says that Vim script has been growing over time, while preserving backwards compatibility, meaning that poor decisions made in the past have had to be maintained, and the need to be compatible with Vi restricts possible solutions. Execution is quite slow, each line is parsed every time it is executed.

The main goal of Vim9 script is to drastically improve performance. 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. A secondary goal has been to avoid Vim-specific constructs and get closer to commonly used programming languages, such as JavaScript, TypeScript and Java.

What this means is that Vim9 script isn't 100% backwards compatible. The Vim developers say that an example of this is in the way function arguments are made available by creating an "a:" dictionary. This involves quite a lot of overhead, and in a Vim9 function this dictionary is not available. Other differences are more subtle, such as how errors are handled.

Given Vim remains popular because of its familiarity and simplicity, the change to the script language will cause concerns, but the team says legacy scripts will keep working as before, and there are no plans to drop support for legacy script.

Other more minor changes and improvements include the requirement for functions to be defined with def to make use of the speedup, and the requirement that argument and return types must be specified.

Line continuation no longer requires a backslash, function calls do not require call, assignments are done without let and expressions are evaluated without eval. The team says this makes a Vim9 script look a lot more like most programming languages.

Vim 9 is available now. 

vimlogo

More Information

Vim Website

Related Articles

Learn Vim with the OpenVim Interactive Tutorial

Vim In The Browser - The Magic of WASM  

One Million Programmers Want To Escape Vim

Which Code Editor Do Devs Prefer? 

//No Comment - Vim And EMACs 

Vim.js

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Android Studio Iguana With Crash Reports
05/03/2024

Google has announced that the latest version of Android Studio, Iguana, is now stable. It has version control system support in App Quality Insights and new built-in support for creating baseline prof [ ... ]



Opaque Systems Introduces Gateway GenAI Solution
14/03/2024

Opaque Systems has announced an early access program for Opaque Gateway, software designed to address data privacy, security, and sovereignty concerns in managing GenAI implementations.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info