Ayao "Alqualos" Kuroyuki (ayao) wrote,
Ayao "Alqualos" Kuroyuki
ayao

Emacs and Vim

One of the most religious things in the Unix operating systems is probably a choice between Emacs and Vim - the two most powerful text editors in the world. I am not going to go into another kind of "Emacs vs Vim" philosophy, but instead I have something to say about Emacs and Vim together.

I am using Vim for a long time already, and I am not feeling like tossing it away. It is very good, if not even better. In fact, I have never seen an editor which allows to type so fast, and I probably never will. Well, at least while keyboard remains fastest input device. In addition to typing speed, Vim has very good basic editing primitives, syntax highlighting, ability to compile programs from within editor, folding, and tags support. Using folding you easily can edit large texts with structure such as programs and LaTeX sources. Very nice indeed. Syntax highlighting is not even worth mentioning because every good editor just must support it, but what is worth mentioning is that Vim supports about 400 different languages and dialects. Compiling programs from editor would be useless, but if compilation fails, Vim moves you to the first error - very useful. Tags support provides you a quick hypertext-like navigation mechanism - just press Ctrl+] on function name, help topic or alike - and you are there.

Having said it all, Vim still has some major flaws. Most important of them is a lack of the flexible interactive process integration mechanism. It does not work with debuggers, version control systems, spell checking software and everything else that requires non-batch interaction with external processes. It supports a spell checking, actually, but it is not very good, because it is based on periodical calls to the spell checker, not interactive communication. As for everything else mentioned, I have seen nothing good for this tasks in Vim.

And here is where Emacs comes in. While Vim is just powerful text editor and nothing more, Emacs is more like a generic template for some kind of IDE. It has very good version control system and debugger integration bundled right in. As for spell checking, it has much better engine, but I could not make it spell check UTF-8. Still, it does not change the fact that Emacs has very powerful interactive process integration mechanism, which Vim lacks. As for version control and debugging - it just rocks. Setting breakpoints from editor, tracing execution within it, syntax highlighting for interactive debugger output, basic version control commands bound to convenient keys, ability to view arbitrary file revisions from editor, and such.

Still, Emacs is much slower than Vim. All these "C-a C-u 3 C-k ESC S-<" instead of Vim's "3ddgg" can drive Vim's user crazy. Well, I am pretty sure that once I get used to it and find what operations I need the most and bind them to convenient keys, Emacs will become much more friendly to me, but I seriously doubt that it will give me typing speed comparable to Vim.

Therefore I conclude that it is no wonder people keep arguing about these two editors, forgetting everything else. They are really good, each in its own way, and I see no other choice except using them both. What is left to decide is when use which. As far as I can see now, Vim is better when you need more typing and less other operations, and Emacs is better when you find yourself simultaneously fixing, debugging, committing, updating and such. Therefore, for mail - Vim is definitely better, for editing configuration files - too (I even use Vim to edit Emacs configuration file, and find it very useful), for initial stages of development, when you think about designing and coding more than about committing and debugging - Vim again. For debugging and quick fixing purposes, Emacs only. And what is really sucks about it, is that even basic operations are done in Emacs and Vim with completely different key bindings. For example, basic cursor movement in Vim is "h j k l" while in Emacs it "C-b C-n C-p C-f". I admit that latter is easier to remember (back-next-previous-forward), but if you look at your keyboard, you will have to agree that Vim's keys is much easier to use. Not to mention that in Vim you do not have to press Ctrl.

I have to admit, though, that I only began learning Emacs. My Vim's knowledge is much better, although I am no expert in neither. One thing that is clear for me is that I have to use both to achieve maximum productivity.
Tags: devel, it, unix
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments