What's new in Vim 8

2 Timers

This is another huge step forward and is related to the previous feature. With timers, you can call a function in Vim after a certain amount of time and have it performed only once or repeated at regular intervals. This may simply be a function built in to Vim, or you could use it to call a background process as described earlier.

So, what could you potentially use this for? Well, on its own it might not sound especially useful, but in the context of Vim scripts, it can do a lot. You could use it to make backups of the currently opened file or regularly add information to a status bar in the editor (such as a clock, or CPU load indicator, or a number of new email messages that have arrived). We expect plugin developers to make big use of this feature in particular.

3 Packages

Some people prefer to use Vim in its most vanilla form, maybe with a few customizations to the .vimrc configuration file to make it look a bit prettier. Other users – especially developers – build up a massive armory of plugins and add-ons to turbocharge the editor, but until now, there has been no standard way to manage them. Sure, we have third-party solutions in the form of Pathogen, Vundle, and others, but wouldn't it be better to have this dealt with inside the editor itself?

Well, with Vim 8, native support for packages is now included. You won't need to install an add-on just to be able to install other add-ons – the process will be a lot simpler. At the time of writing, as Vim 8 had only just been released, many popular plugins had not been converted to use the new package format. But, we hope to see some of our favorites moved over to the format soon, including:

  • Vim-Airline [3] – An attractive and versatile status bar (Figure 2).
  • Solarized [4] – Smart and eye-friendly syntax highlighting schemes (Figure 3).
  • Surround.vim [5] – Key bindings that work with parentheses, brackets, quotes, XML tags, and so on.
  • NERD tree [6] – A tree-form filesystem exploration tool.
  • Fugitive.vim [7] – Pretty much essential if you use Git.
Figure 2: Vim-Airline is one of the most popular Vim plugins, adding an attractive status line at the bottom.
Figure 3: If you find Vim's default color scheme off-putting, try the Solarized plugin.

4 Window IDs

If you're a casual Vim user but haven't delved into the more advanced features of the editor, you may not be aware of windows – or "viewpoints onto a buffer" in Vim parlance. You can open multiple windows in Vim to view different files or, indeed, work on the same file, and this feature is especially useful if you're not also rocking a terminal multiplexer such as Screen or Tmux.

Anyway, until now, windows in Vim were given numbers for identification, and as you opened and closed windows, these numbers would change. This was pretty frustrating if you remember that you had /etc/hosts open in window 5 but, because of some other window operations, that has now moved to window 2. Well, in Vim 8, windows now have their own unique IDs, making them a lot easier to find and work with.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News