Software update: Vim 8.2

Spread the love

Version 8.2 of Vi IMproved, aka Vim, has been released. This universal editor was once developed by Bram Moolenaar for the Commodore Amiga, but is now also available for Unix, Linux, macOS, OS / 2, DOS and Windows. Vim is not actively developed and usually there are a few years between the different versions. The following improvements have been made in this release:

Vim 8.2 is available!

Vim 8.2 is a minor release, a lot of bugs have been fixed, documentation was updated, test coverage was improved, etc. There are a few interesting new features, see below.

For MS-Windows, download the self installing executable. Signed MS-Windows files will soon be available on the vim-win32-installer site. For Unix you probably want to get the latest version using git, see the github page. Otherwise see the Download page for options.

Background

Before I did the keynote at VimConf 2018 I asked plugin developers what they wanted from Vim. The result was a very long list of requested features. The top two items were clear: Popup windows and text properties.

After more than a year of development the new features are now ready for the Vim crowds. Popup windows make it possible to show messages, function prototypes, code snippets and anything else on top of the text being edited. They open and close quickly and can be highlighted in many ways. More about that below.

This was no small effort. Although the existing window support could be used, popup windows are different enough to require a lot of extra logic. Especially to update the screen efficiently. Also to make it easy for plugin writers to use them; you don’t need to tell Vim exactly where to show one, just give a reference point and the text to display, Vim will figure out the size and where the popup fits best.

Text properties can be used for something as simple as highlighting a text snippet or something as complicated as using an external parser to locate syntax items and highlight them asynchronously. This can be used instead of the pattern based syntax highlighting. A text property sticks with the text, also when inserting a word before it. And this is done efficiently by storing the properties with the text.

The new change listener support can be used to keep the highlighting up-to-date and support other LSP features. An example of what can be done with this is the “govim” plugin. It connects to a server (written in Go) and uses “gopls”, the Language Server Protocol (LSP) server for Go. You can find a list of features with links to demo videos on github. A couple of screenshots are below.

Demo game

To show what is possible with popup windows (and because I sometimes get bored fixing bugs), I created a silly game. This uses popup windows that move across the display, text properties to highlight the animals and even sound to make it more fun! Thanks for my colleagues Greg, Martijn and Shannon for making the silly sounds. You can find it on github.

Other noticeable new features

  • A “: const” command for declaring a variable that cannot change: const TIMER_DELAY = 400
  • A Dictionary with literal keys to avoid all those quotes: let options = # {width: 30, height: 24}
  • A heredoc-style assignment to easily assign a list of lines to a variable without quoting or line continuation: let lines = << trim END line one line two END
  • Function chaining for method calls: mylist-> filter (filterexpr) -> map (mapexpr) -> sort () -> join ()
  • The xdiff library has been included for a much improved diff view.
  • When ‘incsearch’ is set it also applies to “: substitute”.
  • “modifyOtherKeys” was added to allow mapping more key combinations.
  • ConPTY support was added for Windows 10, can show full color in the console.
  • The MS-Windows installer supports translations, silent install and looks much better.

A big thanks to all the developers who helped implementing and testing this!

Popup windows

The main new feature of Vim 8.2 is support for popup windows. These can be used to display text on top of other windows and are very flexible: they can be positioned relative to text, at an absolute position or just in the middle of the screen. The size can be fixed or can adjust to fit the text. A “zindex” value specifies what popup window goes on top of others.

The popup window can react to user input. This works with a filter callback. The filter can handle a few keys and pass on the rest, or it can consume all the keys, thus grabbing focus. This allows for very flexible use of the popups.

Popup windows can be used for many purposes, here are a few examples:

  • When a background build finishes a message popup can show “Build finished successfully” on top of the screen, without interfering with what the user is working on.
  • When using Insert mode completion extra info for a completion item can be displayed in an info popup.
  • A list of choices can be displayed, where the user selects an entry with keys or with the mouse.
  • While typing a function call, a popup can show the documentation and the list of arguments, just next to where the user is typing. The new text properties feature can be used to highlight types.

Plugins are the main audience for the popup window feature, there are many options to change the positioning, size and highlighting.

Version number 8.2
Release status Final
Operating systems Windows 7, Linux, BSD, DOS, macOS, Solaris, UNIX, Windows Vista, Windows Server 2008, Windows Server 2012, Windows 8, Windows 10, Windows Server 2016
Website Vim
Download https://www.vim.org/download.php
License type Conditions (GNU / BSD / etc.)
You might also like