Quantcast
Channel: Fast Company
Viewing all articles
Browse latest Browse all 4679

Why Vim, An '80s Text Editor, Is Still The UI Of Choice For Power Users

$
0
0

If you want to improve productivity on any piece of frequently used software there's a simple solution: ditch the mouse and use keyboard shortcuts instead.

Plenty of you already know to hit control-c and control-v to copy and paste, or control-t to open a new browser tab. But a relatively small but dedicated group of people have embraced an alternate set of even more efficient keyboard shortcuts dating back to a decades-old, open source text editing program called Vim.

Vim's fans say its keyboard commands, which let you edit and scroll through documents while barely moving your hands from the keyboard's central home row, save time and help stave off carpal tunnel syndrome.

"Reaching for the mouse is slow and when done repetitively can lead to physical pain for a lot of people," developer Eric Van Dewoestine wrote in an email. "Although most programs have many key bindings that eliminate the need for the mouse, they rely heavily on meta keys (ctrl, alt, etc.) which requires a lot of awkward hand movements using your weakest fingers."

The Vim editor is especially popular among developers, and as such many people have built and released add-ons to let them control other software, from web browsers to programming tools. Van Dewoestine built one called Eclim that allows Vim to access features from iTunes and Twitter as well as the Eclipse development environment, all using Vim's arcane but beloved interface.

"Vim's editing commands are not easy to master," wrote Daniel Choi, creator of tools to control iTunes, Gmail, Twitter and other common programs from Vim, in an email. "You have [to] learn the command grammar and train your muscle memory over time. But by the same token, Vim raises manual text editing from a mundane chore into an art that rewards study and practice, like playing guitar, swimming, or jujitsu."

Vim got its start in 1988, when Dutch programmer Bram Moolenaar began work on a version of the popular Unix editor vi for the Amiga platform. Vi itself dates back to the 1970s, and Vim was initially billed as a "vi imitation." But after Moolenaar made some enhancements and ported the software back to Unix in the early 1990s, the name began to officially stand for "vi improved," according to his website.

Screenshot: via Wikimedia Commons

Unlike most recent software, where keyboard commands are distinguished one by one from regular input by using keys like control, alternate, or command, Vim ships with several "modes." In Vim's insert mode, the keyboard works in a similar way to most software: hit a letter or number key, and that character is added to the current document. But toggle to command mode, usually by hitting the escape key, and the keys take on new meanings: h, j, k and l substitute for the arrow keys and navigate up and down; d cuts and deletes text; y "yanks," or copies, and p pastes.

Combinations of keys have meanings frequent users come to know as well as Windows users know control-alternate-delete or old school gamers know the Konami code: dd deletes a line of text, for instance, and dw deletes a word. Numbers generally repeat the following command a certain number of times, so 5dd cuts five lines, and 3p pastes three copies of whatever's in Vim's clipboard-style memory.

And that's just the beginning. There are Wikis, tutorials, and tip sheets to help beginners master all the possible commands, and power users say being able to switch modes and reuse the most easily reachable keys to enter commands saves an incredible amount of time and wrist strain. For them, using control-key-based shortcuts on other software is like trying to type an all-uppercase document on a computer with no caps lock key.

"Vim's editing mode feels so natural and elegant to me at this point that I feel like I've lost a limb when I'm using a non-Vim interface to write and edit text, like Apple's TextEdit or Gmail, or even just scan and navigate textual information, like iTunes," Choi wrote.

His software actually harnesses APIs in other programs and Vim's built-in scripting language to navigate Gmail mailboxes and iTunes playlists and send tweets directly from the editor.

Other developers have built tools to add Vim's interface to other pieces of software, as well. Developer Anton Khodakivskiy created the plugin VimFx to add Vim-style shortcuts to Mozilla Firefox. Hit "shift-alt-v" with VimFx installed, and the browser slides into command mode, where h, j, k, and l scroll, f follows a link, and o opens a new address.

"It's just real simple," he says. "It takes me a fraction of a section to follow a link using one of these plugins, versus just moving my hands and mouse."

And VimFx is just one of several alternatives for those looking to surf the web, Vim-style: it's based on a Chrome plugin called Vimium, Khodakivskiy says, and alternatives for Firefox, like the Pentadactyl project, offer different takes on the interface.

Another project, called Vimprobable, offers a complete browser designed to be controlled from the keyboard, with a Vim-style command mode for most interaction and an insert mode for inputting text. Based on the WebKit engine, it shares a common lineage with Chrome and Safari, though creator Hannes Schueller says it's designed to be lightweight, making it easy to disable features like JavaScript, browser plugins, and even automatic image loading with a few keystrokes.

"I see the main advantage in providing direct access to functions and features," Schueller wrote in an email. "If I want to switch proxies in Vimprobable, I can do so in a matter of seconds by simply triggering the appropriate command whereas most other browsers force me to move my hand to a mouse and then send me through five unintuitive sub-menus. Modal operation of Vim enables me to avoid using wrist-straining key combinations."

Developers acknowledge the learning curve can be steep for casual users. The creators of Vim interface tools acknowledge that their base is mostly programmers who are using the editors to write code. Even other developers don't always build programming tools with textual controls in mind.

"In the case of Eclipse, the major hurdle is that some features are closely tied to the graphical interface, wrote Van Dewoestine, the Eclim creator. "The [Java development toolkit] in eclipse did a great job of keeping the core functionality decoupled from the GUI, but other plugins for other languages have core features which rely on passing around GUI objects, or objects which have dependencies on parts of the GUI. To get around this I've had to create dummy mock objects to trick some of the code to think it is working in a graphical interface."


Viewing all articles
Browse latest Browse all 4679

Trending Articles