Vim 8.0

Vim 8.0 is finally out! The Vim 8.0 announcement includes an overview of the main features of this major release. One of the significant changes is asynchronous I/O, which means plugins can execute without blocking Vim's UI. The communication protocol used for this supports JSON, which means you can write servers in practically any language as long as you can read and write JSON.

Here's what :help version8 says about asynchronous I/O with JSON:

Closely related to channels is JSON support. JSON is widely supported and can easily be used for inter-process communication, allowing for writing a server in any language. The functions to use are |jsonencode()| and |jsondecode()|.

This makes it possible to build very complex plugins, written in any language and running in a separate process.

Vim also now supports packages. Packages can contain multiple Vim plugins, and can be a version control repository, like Git. The package system scans packpath for plugins under pack/*/*start during startup, and then adds those paths to runtimepath. In that sense it reminds me of how Pathogen works. You can also optionally load plugins with :packadd.

There's a section in the manual under package-create (:help package-create) with details on how to write packages. I'm still not clear on how the package system works in practice: the manual recommends using version control instead of archives to distribute packages so it's easier for users to update them, but I can't seem to find a built-in "update all packages" command.

There are lots of other new things in this update: lambdas look nice for Vim script authors (:call filter(mylist, {idx, val -> val > 20})), and there are some new Visual and Insert mode commands.

If you want to get it, there's a tagged version 8 on GitHub, or you could try your package manager. On a Mac I upgraded Vim with Homebrew like this:

brew update
brew upgrade --HEAD vim
➜  ~ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 12 2016 14:40:07)

It'll take some time for the community to take advantage of the new asynchronous API and the built-in package system, so I wouldn't rush to update unless you want to experiment.

blog comments powered by Disqus