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. 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. More InformationRelated ArticlesLearn 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? 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.
Comments
or email your comment to: comments@i-programmer.info |