Vim isn’t the best tool for every task, and there’s no reason you shouldn’t stick to your GUI IDE if you know it like the back of your hand and are highly productive in it. The very basic best practices for text editing in general apply just as well to more familiar editing interfaces as they do to Vim, so nobody should be telling you that Vim is right for everyone and everything and that you’re wrong not to use it.
However, because Vim and
vi-like editors in general have a lot of trouble
shaking off the connotations of their serverside, terminal-only, mouseless
past, there are a few persistent objections to even trying Vim that seem to
keep cropping up. If you’re someone curious about Vim but you heard it was
useless for any of the following reasons, or if you’re an experienced user
looking to convince a hesitant neophyte to try Vim, the following list might
clear a few things up.
Vim takes too long to learn
If you want analogues to all of the features in your IDE, that would likely take some time, just as it would in any other new editor. However, if all you need to start is to be able to enter text, move around, and load and save files, you just need to know:
ito enter insert mode,
Escto leave it
- Arrow keys to move around in both modes
:e <filename>to load a document
:w <filename>to save a document
:q!to ignore unsaved changes
To do pretty much everything Windows Notepad would let you do, on top of that you’d only need to learn:
ddto cut a line
yyto copy a line
pto paste a line
/<pattern>to search for text
nto go to the next result
:s/pattern/replacementto replace text
From that point, you only get faster as you learn how to do new things. So saying that Vim takes weeks to learn is a bit disingenuous when the essentials can easily be mastered with a few minutes’ practice.
Granted, the arrow keys are a bit of an anti-pattern, but you can worry about that later.
Vim has no GUI
Vim has a GUI version called Gvim for both Windows and Unix. For Mac OS X, the MacVim port is preferred. For experienced users the GUI’s only real advantage over the terminal version is a wider color palette, but it has a toolbar and other GUI elements which some new users may find useful.
Vim doesn’t have spell checking
Vim allows spell checking with system dictionaries, using
:set spell and
:set spelllang. Misspelt and unknown words are highlighted appropriately.
Vim doesn’t have syntax highlighting
Vim has support for syntax highlighting that can be turned on with
enable, for a very wide variety of programming languages, markup languages,
and configuration file syntaxes.
Vim only allows eight colours
This is a limitation of terminal emulators rather than of Vim itself, but most
modern GUI terminal emulators allow 256 colours anyway with a little extra
setup. The GUI version, Gvim, has full color support with the familiar
Vim doesn’t have class/function folding
Vim does in fact have support for folding, based on both code structure
and manually defined boundaries. See
:help folding for details.
Vim doesn’t have autocompletion
Vim allows basic completion using words already in the current buffer, and also more advanced omnicompletion using language dictionaries for constants, variables, classes, and functions.
Vim doesn’t have a file browser
Vim has had the Netrw plugin bundled for some time, which provides a pretty capable filesystem browser.
Vim can’t do network editing
Again, the bundled Netrw plugin handles this. Editing files over FTP and SCP links is pretty transparent. You can open a file on a remote server by entering the following, which will prompt for your username and password:
When you’re done editing, you just enter
:w to save the file, and it’s
automatically uploaded for you. You can record your FTP credentials in
.netrc file to save having to type in usernames and passwords all the time.
scp:// work the same way; with a good public key
infrastructure set up, you can use Vim quite freely as
a network-transparent editor.
Vim doesn’t have tabs or windows
The model Vim uses for tabs and windows is rather different from most GUI editors, but both are supported and have been for some time.
Vim has too many modes
It has three major modes: normal mode, insert mode, and command mode. There’s a fourth that’s Vim-specific, called visual mode, for selecting text.
Most editors are modal in at least some respect; when you bring up a dialog box, or enter a prefix key to another command, you’re effectively changing modes. The only real difference is that context shifts in Vim are at first less obvious; the screen doesn’t look too different between normal, insert, and command mode.
showmode option helps to distinguish between insert and normal mode,
a common frustration for beginners. This gets easier when you get into the
habit of staying out of insert mode when not actually entering text.
Vim doesn’t work with the mouse
Vim works fine with the mouse, in both Gvim and
emulators, if you really want it. You can change the position of the cursor,
scroll through the document, and select text as normal. Setting the below
generally does the trick:
However, even a little experience in Vim may show you that you don’t need the mouse as much as you think. Careful use of the keyboard allows much more speed and precision, and it’s quite easy to run a complex editing session without even moving from the keyboard’s “home row”, let alone all the way over to the mouse.
Vim doesn’t do Unicode
Vim supports Unicode encodings with the
encoding option. It’s likely you’ll
only need to put the below in your
.vimrc file and then never really think
about encoding in your editor again:
Vim isn’t being developed or maintained
The original author of Vim, and its current maintainer and release manager, is Bram Moolenaar. At the time of writing, he is working for Google, and is paid to spend some of his time developing Vim. The development mailing list for Vim is very active, and patches are submitted and applied to the publically accessible Mercurial repository on a regular basis. Vim is not a dead project.
Vim is closed source
Vim isn’t proprietary or closed source, and never has been. It uses its own GPL-compatible license called the Vim license.