The Evolution of Vi
Vi was first released over 40 years ago. Since that time, it has been used by countless of people, quickly becoming the de facto standard Unix editor. Then, in 1991, Vim (Vi Improved) was released. Vim improved upon the ideas established by Vi, offering a slew of new features and tools.
Then, two years ago, the next evolutionary step of Vi began. NeoVim began as a fork of Vim but is quickly establishing itself as a separate entity. Most of the original codebase has been gutted, cleaned up, and rewritten. Even though the NeoVim effort only began two years ago, it already boasts impressive features and innovative ideas. Some are even heralding NeoVim as the future of Vim itself.
Vim has become quite ubiquitous on Linux and Unix platforms, and people have come to expect that Vim will run on even the most ancient of hardware. Due to the plethora of arcane and obsolete platforms that Vim must support, much of its codebase has grown to be bloated and difficult to understand. In addition, Vim continues to maintain backward compatibility with Vi, offering “vi-compatible” and “ex” modes.
NeoVim, whose goal is to modernize and streamline Vim, drops support for legacy systems such as Amiga, BeOS, and MS-DOS. In addition, all vi-compatible modes have been removed, resulting in a much cleaner, leaner codebase.
While Vim plugins such as Conque and VimShell attempt to bring shell capabilities to Vim, NeoVim has built terminal buffers directly into the editor as first-class citizens. This makes it possible to execute commands as window splits, enable syntax highlighting, and even use copy and paste with Vim shortcuts between an editor and a terminal (or even two terminals!) This flexibility has caused some users to adopt NeoVim as a terminal multiplexer, replacing programs such as tmux.
Crafting a New Plugin API
One of Vim’s most powerful assets are the thousands of plugins and enhancements available for the editor. There are new syntax highlighters, syntax checkers, even file managers built as Vim plugins. However, one of the drawbacks of Vim’s plugin architecture is that Vim executes plugins in a serial and synchronous manner.
Due to this limitation, plugins can easily slow down the editor, rendering the user interface completely unresponsive during intensive operations. In addition, plugins are generally written in a custom scripting language called Vimscript.
NeoVim reengineered and rearchitected the plugin system, introducing a new MsgPack-based plugin API. While Vimscript will continue to be supported, the new API offers some exciting features and opens up brand new realms of possibilities. By creating a standard API in a well-established protocol. NeoVim makes it possible to easily interact with the editor remotely and even embed it inside other applications.
NeoVim’s new API has opened new possibilities for plugin developers. Here are some plugins which are either exclusive to NeoVim or offer enhanced functionality when installed on NeoVim.
NyaoVim is a web-enhanced frontend to NeoVim. It allows a mini web browser to be embedded into the editor, providing some unique features. Live previews of HTML and rendered Markdown can be displayed as vertical splits.
Deoplete stands for “dark powered neo-completion”. While some of Vim’s autocomplete plugins slow down or even hang its interface, NeoVim’s API allows deoplete to provide fast, asynchronous keyword completion. Rather than attempting to “reinvent the wheel”, it wraps and enhances legacy autocomplete plugins, allowing them to provide the same functionality, but with a greater amount of responsiveness.
NeoTerm enhances NeoVim’s built-in terminal. It allows users to monitor command statuses from the infobar, execute and monitor unit tests, easily copy code, and execute copied code inside an already running interpreter.
Neomake provides syntax checking and build functionality to NeoVim. This runs asynchronously, working in the background to report build progress and issues as they are encountered.
Floobits is a service which offers real-time, collaborative editing on native editors. It works across editors and even platforms. Although they used to support a Vim plugin, but have since dropped Vim in favor for NeoVim.
nvim-ipy integrates iPython and Jupyter notebooks into NeoVim. Similar plugins exist for Vim, but nvim-ipy has the ability to asynchronously execute long-running commands. In addition, the resulting output is collected in the background and reported in the editor.
neovim-intellij-complete brings IntelliJ’s completion into NeoVim.
nvimux provides a set of keybindings which leverage’s NeoVim terminal to mimic tmux.
nvimfs is a FUSE file system which exposes the NeoVim API. This allows users to interact with NeoVim remotely, executing commands and retrieving the results using standard redirects and reads to/from special files within the nvimfs.
Although NeoVim began as a fork of Vim, it has quickly become the next evolutionary step of Vim. Its terminal, and especially the MsgPack-powered asynchronous API, has already opened new possibilities not previously achievable on Vim.