Take the 2-minute tour ×

This question already has an answer here:

I have been writing code so far in conventional text editors that come with the OS so far or use an IDE in some cases. I know there are some advanced text editors like Emacs and Vim available solely for the purpose of coders. How important are they really? Should a programmer dealing with PHP, Python etc. learn these editors? What are the advantages that they provide over conventional editors like Notepad++, Scribes etc.?

share|improve this question

marked as duplicate by gnat, BЈовић, Kilian Foth, MichaelT, Giorgio Aug 2 '13 at 9:58


For the young ones amongst us - vi is the standard editor under Unix. vim is a modern clone which is frequently installed instead on Linux systems. It is a tribute to vim that the differences in the non-GUI version are hard to spot. Stuff like how much you can undo and such. –  user1249 Apr 18 '11 at 6:09
@OJ: There are few systems that will support programming that vim can't be installed on. There are doubtless many where it isn't installed, and there are reasons why you might not want to install it. There may be policies about installing software, you may want to edit something right now, you may not have a fast internet connection or a handy installation CD or thumb drive, or you may just be touching the system briefly and you don't want to install something just for a little use by one person. –  David Thornley Apr 18 '11 at 16:46
"Must a programmer learn text editors like Emacs and Vim?" No. I feel obliged to qualify that, but actually it doesn't need it. So I won't. –  Ian Jul 18 '12 at 21:38
I don't know why people are going around closing questions two years later, but this isn't a dup, at least of the question given. It's actually asking the exact opposite. –  Karl Bielefeldt Aug 31 '13 at 14:57
add comment

12 Answers

up vote 22 down vote accepted

Vim is a really good tool once you familiarize yourself with it.

It starts up faster than any IDE or text editor I've used, and it has syntax highlighting and it indents the code correctly in most cases.

It also helps you focus on the coding process itself, you won't be using the mouse at all to deal with it, that'll save you a lot of time when you're just writing code.

It has a wealth of plugins for whatever it is you're doing, as well.

I haven't used emacs to be honest, but I'm sure there are people here who like it, I personally don't like having to press Ctrl or Alt all the time.


Vim's usefulness also depends on what you're writing.

If you're an API developer (Java, C#...etc) you'll most probably be more comfortable with an IDE.

But if you write scripts (Bash, Perl...etc), Vim might be the way to go, since you need to write something fast, Vim is fast, and does everything you need.

share|improve this answer
Vim is also an excellent environment for more complex work. (I typically work in rather large codebases in Vim, and frequently have dozens of files open in various windows and tabs, and can even do a good deal of debugging there.) –  greyfade Apr 17 '11 at 16:11
@greyfade yes, but I'm not comfortable with not having autocompletion when dealing with large APIs like when coding Java web applications, which will involve external APIs as well as the language's standard library, which in Java's case is huge –  Mahmoud Hossam Apr 17 '11 at 16:15
And I despise hitting escape all the time. Whats the point. –  Rig Jul 18 '12 at 21:30
Another advantage of vi/vim is that it does a much better job with multi-GB files than other editors. –  tylerl Jul 19 '12 at 3:04
@tyler if you have multi GB files you're doing it wrong. –  It'sNotALie. Sep 1 '13 at 12:26
show 7 more comments

A programmer should not necessarily learn a lot of tools, but learn a few and learn them well.

Emacs and vim each have their distinct strengths but unless you use them a lot on a regular basis you will not benefit enough from them, I think. Especially not if you are a learning programmer.

You will, however benefit from a good IDE, but you should also be able to do real work just given a plain, simple editor.

share|improve this answer
The problem with vim or emacs for a programming beginner is that if you want to learn how use (say) vim, you now have two problems: learning to write code, and learning to write code in vim. That said, those who persist and do learn will be greatly rewarded. –  Rein Henrichs Apr 18 '11 at 0:16
I actually found that having learned Emacs as a (relative) beginner, life was much easier: whenever I wanted to use a shiny new language (say Haskell), I could still use the same editor. Before, I had trouble switching between random languages because of the different IDEs I tried to use. –  Tikhon Jelvis Apr 18 '11 at 7:47
@Tikhon, perhaps it is so long ago that you cannot remember the learning curve of Emacs? –  user1249 Apr 18 '11 at 7:53
I was a high school student then (last year) and became very comfortable with it in a single semester. Make of that what you will. –  Tikhon Jelvis Apr 18 '11 at 7:56
Daily use isn't necessary to justify learning vim or emacs. I use vim fairly frequently, but days can pass when I don't use it. I still get a great deal of value from knowing how to use it. A beginning programmer probably should learn programming first, and vim or emacs later, but the payoff lasts the rest of your career. –  David Thornley Apr 18 '11 at 16:50
show 1 more comment

Importance of vi is that you will always find it on any flavor of UNIX (standard both in SysV and BSD flavors) or UNIX-like system. Note however it might be original vi, not vim. You're not guaranteed to have any other editor installed. Also in Linux it's in /bin, so it's available even if /usr failed to mount.

share|improve this answer
Another editor that’s (was?) always available is ed. Quite handy when connecting to a server via unreliable modem/POTS with low baud rate. –  Bavarious Apr 18 '11 at 4:13
@Bavarious In fact, vi was originally written as the VIsual mode for a line editor called ex, which in turn is an advanced version of ed. –  Rein Henrichs Apr 18 '11 at 7:28
vi is superset of ed –  vartec Apr 18 '11 at 8:53
@Bavarious: And, with experience with several different editors named "ed" on several different systems, I've adopted a rule: Never use an editor called "ed". –  David Thornley Apr 18 '11 at 16:51
add comment

Are you a fast touch typist? Do you often wish for more keyboard shortcuts to make edits? Does the time you spend editing interrupt your train of thought? Do you find little things about your editor that you wish you could customize to work just the way you like it? Do you not mind spending potentially a lot of effort up front if it means it will save you more time and effort in the long run? Are you unbothered by people considering you anachronistic? If so, then vim may be a good fit for you.

Do you prefer to be able to figure out your editor without reading the manual, even if that means fewer features? Are you more comfortable using what everyone else in the office is using? Do you use the mouse for everything? If so, then vim may not be a good fit for you.

share|improve this answer
+1 - Great objective answer that gives both perspectives of which is better. –  jmort253 Apr 18 '11 at 5:47
Everyone in our office uses vim. I do not find it anachronistic at all. –  Rein Henrichs Apr 18 '11 at 7:29
add comment


If you want to learn how to use them, don't do it in a production environment. Do it on your downtime or time set aside specifically to get used to writing code on them. When you get more experience, introduce it to your environment but keep the program you are used to near by. I kept frontpage near by when I decided to transfer to a pure text editor, until I was confident enough that I no longer needed it.

share|improve this answer
And keep a cheat sheet handy :-) –  Jay Elston May 18 '11 at 5:04
+1 Do not learn in production environments. I have seen outages because of ineptness with a text editor. –  Monster Truck Aug 31 '13 at 12:56
add comment

I think that learning Emacs (and probably Vim as well) is very useful. Why? Simple: I can use the same exceptionally capable editor for more or less everything I do.

This is great because I am a student, constantly learning how to use shiny new things. This year, I played around with Haskell, did a ton of JavaScript, used Scheme, wrote some Java, screwed around with Perl, worked on a web site... Emacs was great for all of this.

In the past, I had some problems with different languages: I would pick up Perl or Python, but could not find a good editor for either. Now, I know I can always use Emacs. Of course, sometimes Emacs does not have all the features I want, but it always has enough features off the bat to use for quick projects. For longer projects, it may need some customization, but the time taken to do that is probably equal to getting and learning a new IDE.

In short: Emacs is great because it supports so many different languages, and is powerful enough even without support for a specific language to make life much better.

share|improve this answer
add comment

Nowadays popularity of various kinds editor worship most likely comes from Pragmatic Programmer book,

or, to be precise, from readers who mindlessly crammed Chapter 3 Basic Tools -> Power Editing -> One Editor but totally missed the key (pragmatic!) takeaway laid out in Preface chapter:

There are no easy answers. There is no such thing as a best solution, be it a tool, a language, or an operating system. There can only be systems that are more appropriate in a particular set of circumstances.

This is where pragmatism comes in. You shouldn't be wedded to any particular technology, but have a broad enough background and experience base to allow you to choose good solutions in particular situations...

You adjust your approach to suit the current circumstances and environment. You judge the relative importance of all the factors affecting a project and use your experience to produce appropriate solutions. And you do this continuously as the work progresses.

If one gets the general understanding like above, this alone makes the book worth reading. Main idea to keep in mind is one that authors stated clearly and unambiguously, "there is no such thing as a best solution".

share|improve this answer
add comment

There are at least three reasons why a newly minted programmer might choose to spend some time learning emacs and vi:

  • tradition: Both vi and emacs have been around since Moses picked up his output on stone tablets. In fact, God himself may have invented either vi or emacs, and the devil the other, but you'll get different answers as to who invented which depending on who you ask. (You've heard that it's a religious argument, right?) At any rate, these two editors have enabled quite a bit of history, and stories and jokes involving them abound. You may feel unable to understand your roots without some knowledge of both. For example:

    How many vi users does it take to change a lightbulb?

    ne, as long as he doesn’t forget to enter ‘insert’ mode first.*

  • inertia: There are a lot of people out there who have emacs and/or vi keystrokes burned into their neurons like the high score on a Defender machine. I don't think that anyone would hold up either editor as a shining example of modern user interface design, but since so many people already know the commands, newer editors often build in support for vi and/or emacs commands. MacOS X is perhaps the best example of this: you can use a surprising number of common emacs commands in any Cocoa-based application (unless you're one of those people and install a vi-based input manager). Many IDEs and text editors on all major platforms offer key bindings for vi and/or emacs, and probably will for a long time to come. So, just as you've learned to type on a QWERTY keyboard, you'll probably also pick up some commands derived from an ancient text editor whether you know it or not.

  • power: I'm not so sure about vi, but it's safe to say that there are very few editors that come close to the power and flexibility available in emacs. Don't like the way something works? You can change it. Don't feel like dropping out of your editor to use the command line? No problem -- you can do everything you need right inside emacs. You'll need to spend a lot of time studying in the swamps of Dagobah to learn to tap into all that power, but some people may find that worthwhile, perhaps even just for its own sake. vi is more like a Leatherman tool hanging on your belt: versatile, always ready, and useable for all sorts of things.

Now then, is it important to learn vi and/or emacs? I'd say that it's useful to know something about both of them, especially so that you know at least a bit if you ever find yourself needing to use them (you might). But not knowing them won't necessarily hold you back. It's much more important to know how to wield the tools that you use daily as effectively as possible.

* That's not a typo -- you'll get it after you spend your first hour with vi.

share|improve this answer
add comment

Neither emacs nor vi are solely meant for coding; they just happen to support features that make writing code a little easier.

vi's sole virtue is its ubiquity; any Unix or Linux-based system is going to have an implementation of vi. It's light-years friendlier than TECO was, but so's using an Etch-a-Sketch. That said, vi is my primary editing tool in a terminal session, simply because I never had the bandwidth to learn it and emacs at the same time (and emacs has too damned many keycode combinations).

You don't need to learn either tool; there are other quality text editors out there that support many of the same features in a friendlier format.

share|improve this answer
"vi's sole virtue is its ubiquity" - I've seen some negative things said about vi/vim before but this is a bit extreme. It's like comparing it to MS-DOS edit or Windows Notepad. Surely it has other positive features, like very fast start-up, comprehensive syntax highlighting, limitless configurability and scriptability, extensive use of keyboard shortcuts, multiple buffers, split screen, I'm sure there's more... –  thomasrutter Apr 18 '11 at 9:06
I'm an extreme kind of guy. –  John Bode Apr 18 '11 at 13:06
I would not say the ubiquity is vi's SOLE virture. With vi (and maybe emacs as well) you can edit text files without having to move your basic hand position. This makes banging out text and code faster (once you have mastered all the magic codes...). This is a mixed blessing. It increases your risk for carpal tunnel syndrome, but greatly reduces your risk of mouse shoulder. –  Jay Elston May 18 '11 at 5:03
add comment

If you need to learn an editor for programming, make it emacs. Why?

If I need to make an rpm and I open emacs, and tell it to find a file which happens to end with the extension .spec WHAM! A skeleton file appears with all the tags and macros already filled in with text color-coded.

And if I want to submit to my favorite version control, esc-x load-library mercurial (or git or svn) puts emacs in the mood to drop down the right commands from its version control menu or to recognize the commands like ctrl-x v v to check in or out code from a repository, and to do everything one can do with a repository.

Optic fatigue occurs when one stares at the same colors for too long. I use konsole for terminal windows and change the colors frequently. With emacs not in a terminal window, I have more than 50 color themes to choose from, some of them comfortably low contrast, like Alice Blue, and some eye-stabbing like euphoria for when I need to stay awake.

I code a lot of python. When I need to test some coding for syntax, I don't leave emacs. I start the Python interpreter, and the screen splits, then I save my python file and import it to the interpreter to check syntax--an error will be readily apparent, and I can fix it immediatelty. When I am done, I can switch to an unsplit window and continue work.

Some folk say use vi, and I do use it on some older SUN systems... I have a regular rhythm--hit i and insert a char then hit escape and hit i again and type the next char... (barely better than ed, but it is what's available).

Usually my first install on any new system is zile. GNU zile is emacs without all the window dressing like browsing and email and irc and colors, just a C-coded binary that works in about 100k and uses emacs keycodes.

If emacs were as onerous as most try to make it sound, it should be amazing that so many folk were gluttons for self-flagellation by making emacs-like editors. MINCE Is Not Complete Emacs, the 31 flavors of micro-emacs, Jed, Zile, Joe and an oddball python coding or two plus web-based YMacs, are all emacsen. peppy http://peppy.flipturn.org/ is a different take, using emacs keycodes and coded in Python and it will edit nigh on everything, including chunks of binary data, and it has dozens of modes for programming languages, but its keycoding paradigm is emacsen.

YEah, emacs is worth learning, and so is vi. Of the rest, maybe Eclipse is as useful, if you can stand the hoggishness of its many inserts. And if you need something REALLY small, lightweight, and fast, check out e3. The x86 version is written in assembler and serves many keycode sets including Emacs and Vi. https://sites.google.com/site/e3editor/

And oh yes, I open emacs, type 17 pages, and BLAP! Lightning strikes and my power goes out. When power is restored, I look at the work and discover I lost the last 7 characters I typed.... And if I decide to follow the "recover crashed session" procedure, I can reduce it to 2 lost.

Python code doesn't believe in indentation, it DEPENDS on them. Emacs is aware of that and makes sure your indentation is proper. But if you decide to remove an "if" you will have a whole region in the wrong indentation status. With emacs you fix that by:

ctrl-space and arrow keys to highlight the region

ctrl-c < to outdent all the highlighted code. (ctrl-c > indents it again, correctly).

I think I have used more than 60 editors, and still the one I come back to is emacs, not because I can get function code stubs in C or proper indentation or color-coding, but because I can customize it beyond its already awesome capabilities. Richard Stallman's brainchild was adapted by so many...

share|improve this answer
Lightning? And your file system is in that good shape afterwards? Well, it does not always end as well. –  user1249 Jul 18 '12 at 22:29
add comment

You don't need to learn Vi or Emacs, you need to learn your tools. Imagine a sniper who doesn't know well the downsides and capabilities of his rifle, he would not be a good sniper ? Would him ?

So go ahead and find an editor you like, you might like Emacs, Vim, Textmate, Sublime Text... heck, maybe you don't like any of them and you are OK with Nano, but what matters is that you are comfortable with your tools.

share|improve this answer
add comment

First things first. VIM is more productive for programming than Eclipse or . Your personal productity in VIM may be abysmal, but the potential cap of VIM is much higher. This is a fact.

VIM is a martial art. It feels unnatural when you first use it. And you can't even make it work. It takes years of practice to gradually become productive. You focus on mastering a little detail at first. Slowly all these bits you master add up until text is flowing effortlessly out of your finger tips onto the screen. Complicated edits that would make your co-worker sigh will jump from your hands before he can finish his exhale. There are few people who can use VIM. Fewer who can use it productivley. And you may never meet a master in your life time. But they are rumored to exist.

VIM is designed to keeep your hands on home-row. Moving your hand from the keyboard to the mouse is demoralizing. It's a gross motor movement. Moving your arm has a phsycological effect that hurts your motivation. Using VIM, someone could bolt your wrists onto the keyboard and you could still easily open up files, split windows, open tabs, build the project, search/replace, change fonts, change colors, etc. And all at lightning speed.

VIM is modal. That means you don't have to do complex key combinations where you hold down control+shift+Key. This hurts your hands in the long run. Instead you execute commands. There is no need for key combos to due to the modal nature.

We store data in our memory like computers do. Our memory can only hold a few values at a time. See how many distinct integers you can hold in your head before they start to slip away. We overcome this human limitation by writing stuff down. If data falls out of our memory we can easily look at what we wrote down to get it back. If your time is spent doing gross motor, physical things you are losing time that could have been spent on processing data in your brain. You want your mind to flow onto the screen without any effort at all. It may not sound like much but VIM's ability to effortlessly transfer what is in your mind to the screen is a BIG productivity boost. It's hard to put in words what I'm trying to say.

VIM supports code completion. Both textual and look-up based. It can pull text from mulitple files. Anything you desire can be had in VIM. Either make it yourself or use something someone else cooked up.

VIM supports goign to definitions with ctags. You can also find all references of an item. Again, anything you desire can be had in VIM.

The scripting of VIM is huge. You can download or create thousands of color schemes and change colors in an instant. Try to change fonts or colors in Microsoft Visual Studio and it will hang for 20 seconds while it loads data. It won't let you store color schemes and you must spend 30 minutes tweaking your colors and fonts every time you want a change of scenery. In VIM you can set line spacing to zero to fit more lines of code on the screen. I get over 80 lines. Visual studio uses 2 pixels of spacing for every line and you can't adjust it!!! Less lines = more scrolling = less productivity = forced to use small fonts for more lines = eye strain.

Split windows are opened in an instnat in VIM. It's usefull when you need to look at data in one section of the code that's far from the place you are typing (or in a different file). You don't have to spend time resizing windows, or worry about GUI windows overlapping each other and falling behind each other. Un-related code windows can be opened in tabs as to not take up screen space, but allow quick switching.

VIM as an IDE: http://www.youtube.com/watch?v=MQy2rVOf-z0&feature=fvwrel

VIM the revenge: http://www.youtube.com/watch?v=lQNFfhC4QI8

share|improve this answer
How can vim be "more productive for programming" when, according to you, it takes years to learn? Beyond that, your answer only explains what you like about vim; it really doesn't address the OP's question. –  Caleb Jul 19 '12 at 2:05
add comment