TL; DR: Celebrating 25 years of productivity and billions of lines of code written, Vim is an open-source text editor loved by millions of programmers around the world. Perhaps not for the faint-of-heart beginner, Vim has a steep learning curve. Once you master it, however, you’ll have the power of an incredibly configurable editor built to maximize your productivity. Creator Bram Moolenaar shares Vim’s evolution from an open-source dev tool to charityware and the product’s first release in a decade. Learning about Bram’s configurations and most-used plugin gives a unique look into a product with which so many — including the HostingAdvice team — are intimately familiar.
Early developers were struggling. They loved the landmark text editor vi but needed something that was available on more than just Unix.
They needed something more tailored to programmers, something that supported syntax highlighting for various languages and remote editing via SSH. They needed to fine-tune their development environments with plugins to maximize their efficiency.
Dutch programmer Bram Moolenaar created his own solution and shared it for free, eventually asking only that users make a donation to a charity caring for children and families in Uganda.
Vim, originally abbreviated from “Vi IMitation,” sought to extend the functionality of the vi editor. With the release of Version 2.0 a few years later, Vim declared the new abbreviation was for “Vi IMproved” because their feature set had surpassed vi.
More than two decades since the text editor’s creation, Vim has become so configurable and adaptable that even Bram doesn’t know about all the features it has anymore.
Users often remind him of tools when responding to other users’ questions on the Vim mailing list, he said, as well as when they use the basic functions he created in new, inventive ways.
“Some people may think that because I wrote the code, I would also know everything about using Vim,” he said. “That’s not so.” Bram has spent decades perfecting tools that streamline development for millions of coders. He’s even come out with a so-called “experimental programming language,” Zimbu, that simultaneously supports multiple styles of programming to adapt to the style and needs of developers.
How Text Editors Help You Code and Why Programmers Love Vim
Developers spend the vast majority of their coding time in text editors, so there should be no surprise at the passionate following these programs have built — in fact, fans of Vim and competing editor Emacs have been fighting a decades-long Editor War that might be the oldest software rivalry.
Proponents of Vim commonly point out the same features as reasons why they use the program:
- Light and portable: Commonly used as a command line interface, Vim can be launched with a terminal, run through a GUI, or used remotely through an SSH connection. Vim is widely used on Windows, Linux, and macOS.
- Highly customizable and full of plugins: As with so many other open-source platforms, users have run amok with creating custom configurations, features, and plugins. Click here for a directory of plugins sourced from GitHub, Vim.org, and directly from users.
- Modality and no mouse functionality: It seems frustrating, but your fingers never need to leave your keyboard. Maximize productivity and coding time by using keystrokes to switch among normal, insert, command line, and visual modes. Keys have different commands based on which mode you’re in.
- Registers: Think of these as multiple clipboards. You can store copied text and macros, which record keystrokes for playback, in different registers. Registers, which persist between uses of Vim, help you save time by executing certain text in a fraction of the time.
- Motions and text-objects: Arguably our team’s favorite facets of Vim, motions and text-objects serve as the verbs and adjectives of the Vim language, allowing you to write your code über-productively. Motions allow you to tack on an action to built-in commands, so you can, say, delete from the current cursor position until the next occurrence of a letter. Meanwhile, text-objects are used in the context of motions, allowing you to declare commands inside or around words, paragraphs, HTML tags, and even current function blocks.
With Vim, developers can have their coding environment work exactly how they want it. It’s all about automating repetitive tasks and making as many things happen as possible with as little effort as possible.
Vim Features From the Founder’s Perspective and Releasing Version 8
Bram originally created Vim, a clone of the vi text editor for Unix, for the Amiga computers of the 1980s and 1990s. Released in late 1991, Vim was soon ported to other platforms.
Among the main early challenges was making the code as efficient as possible and avoiding memory allocations.
“Beside the obvious difference between Windows and Unix-like systems, there are also differences among various Windows versions and among Unix implementations,” Bram said. “When working on Vim 8, I had to spend quite a bit of time making the asynchronous features work properly everywhere.”
Bram’s Favorite Feature, Thoughts on Plugins, and How He Configures Vim
You’d expect Bram’s configuration file, or .vimrc, to contain all the best and cutting-edge tips and settings. As the sole person responsible for Vim, however, Bram uses his .vimrc to try to replicate and troubleshoot users’ problems.
“My .vimrc is a mess,” he said. “I add random mappings and never clean it up. I have some tricks to make it work with older Vim versions, in case I need to try out something. I also have quite a few ‘if’ statements for different systems so that I can use it on all the computers I have.”
That control over the Vim platform, however, means that Bram doesn’t use many plugins.
“If I need something, I add it as a feature,” he said but added that he does use the Netrw plugin included in Vim distributions to navigate through the file system and open remote files. “For example, if someone creates a pull request on GitHub, I can use “CTRL-W f” to open the patch in a window. No need to switch to a browser, download the file, and then open it with Vim.”
Bram admitted to using other editors on rare occasions, and said he always misses the dot (.) command, which repeats a change several times in different positions, and the ability to record and replay a sequence of commands.
“Just a simple ‘change this text into that text’ can be very laborious without a repeat command,” he said. “I haven’t seen another editor that provides this feature.”
What’s New With the Release 10 Years in the Making
In May 2006, Vim 7 introduced an autocompletion system, native support for spellchecking, a tab interface, and advanced undo features. Vim 7 had undergone four updates over the 10 years leading up to Version 8. The gap in updates, however, doesn’t mean Bram wasn’t hard at work.
“I spend too much time on Vim,” he said, adding that he spent nearly all his free time in 2016 getting Version 8 ready.
He announced the first major update in 10 years with a short message in Google Groups promising “interesting new features, many small improvements, and lots of bug fixes.”
The major release includes:
- Asynchronous I/O, JSON, and channels support: Vim can now exchange messages with other processes in the background, making it possible to build complex plugins that run in a separate process.
- Jobs: Vim can now start, stop, and communicate with a job, which can also read or write to a file. This will help run a process for completion or syntax checking, for example.
- Package support: As more and more plugins become available and their usage grows, packages allow an easier and more convenient way to manage and update them.
Our Favorite Tips and Plugins for an Efficient Coding Environment
Here at HostingAdvice, we use Vim religiously for our sites and side projects. With so much familiarity and expertise, we’d be remiss to not share some of our favorite tools. Here is a list of our must-have plugins:
- NerdTree: Display your file system as a tree, enabling you to easily explore and open various files and directories.
- NerdCommenter: Easily toggle the comment status of various amounts of code based on your key mappings.
- Snipmate: Glide through often-typed code, or snippets, that you can quickly insert into your file. Update variables as you type.
- Ctrl-P: Find full paths to files, buffers, and tags. Open multiple files at once and create new files or directories.
- Syntastic: Check your syntax and be notified about errors before compiling your code or executing your script.
For more resources, he also recommends Practical Vim: Edit Text at the Speed of Thought.
“I’m still reading and learn something new every time I pick it up,” PJ said.
Vim Encourages Happy Users to Donate to Help Children in Uganda
Vim started as an open-source project, but a year spent working at a children’s center in Uganda inspired Bram to create International Child Care Fund Holland.
He encourages Vim users to donate to the small non-profit organization, which in turn sends more than 99 percent of the money to the Kibaale Children’s Centre.
“It has worked very well,” Bram said of the idea to ask users to donate the money they think Vim is worth. “There is a steady stream of donations that make it possible for the center to run a clinic and help the children to get a diploma.”
Although dozens of children now graduate each year, the impoverished area is routinely facing hardships. A 2016 drought forced ICCF Holland and the center to hand out extra food to families in the area.
“When doing our daily things, it’s sometimes hard to imagine that there are still people who struggle to get food and clean water,” Bram said. “With a small amount of money, the life of the poor children can be drastically improved.”