<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>So Jake Says &#187; Vim</title>
	<atom:link href="http://www.jakevoytko.com/blog/tag/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jakevoytko.com/blog</link>
	<description>Ye Olde Computer Science Blogge</description>
	<lastBuildDate>Sun, 17 Jan 2010 15:16:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Somewhere Between Vim and Emacs There is a Great Text Editor</title>
		<link>http://www.jakevoytko.com/blog/2008/04/13/somewhere-between-vim-and-emacs-there-is-a-great-text-editor/</link>
		<comments>http://www.jakevoytko.com/blog/2008/04/13/somewhere-between-vim-and-emacs-there-is-a-great-text-editor/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 03:59:57 +0000</pubDate>
		<dc:creator>Jake</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[emacs pinky]]></category>
		<category><![CDATA[modal editing]]></category>
		<category><![CDATA[ragtime typing]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Vim vs. Emacs]]></category>
		<category><![CDATA[viper mode]]></category>

		<guid isPermaLink="false">http://www.jakevoytko.com/blog/?p=70</guid>
		<description><![CDATA[Or: Yes, I&#8217;m The 300th Person To Write This Blog Post. A year and a half ago, I abandoned Visual Studio to try to use the two most popular code editors: Vim and Emacs. Both of them have their advantages, but fall short of being the perfect editor. Vim The first coder&#8217;s text editor I [...]]]></description>
			<content:encoded><![CDATA[<p><em>Or: Yes, I&#8217;m The 300th Person To Write This Blog Post.</em></p>
<p>A year and a half ago, I abandoned Visual Studio to try to use the two most popular code editors: Vim and Emacs. Both of them have their advantages, but fall short of being the perfect editor.</p>
<h2>Vim</h2>
<p>The first coder&#8217;s text editor I used was Vim. It took quite a while to get past its infamous learning curve, but once I did, it was wonderful.</p>
<p><strong>Advantages</strong></p>
<ul>
<li><strong>Easy-to-Reach commands: </strong>The basic movement keys in Vim are right under your fingertips. Rather than wasting precious tenths of a second moving back and forth to the arrow keys, all you need to do is shift your right hand over. &#8216;h&#8217; is left, &#8216;l&#8217; is right, &#8216;j&#8217; is down, and &#8216;k&#8217; is up. This may seem weird at first, but after two weeks of using it, you&#8217;ll be disappointed whenever you&#8217;re typing in any other application.Not only that, but a lot of the extra movement keys are very close to the home row. &#8216;$&#8217; and &#8217;0&#8242;, end and beginning of the line, respectively, are nearby. So is &#8216;^&#8217;, which gets you to the first whitespace character on the line. So is &#8216;G&#8217;, or the goto-line command. So is &#8216;w&#8217;, the &#8220;go to next word&#8221; command. No extra modifier keys needed.</li>
</ul>
<ul>
<li><strong>Modal Editing: </strong>A lot of the power that Vim has comes from the fact that keys work differently based on what mode that you are in. If you are in Command Mode (the default mode in Vim), the &#8216;o&#8217; key inserts a line below the current one and changes the mode to Editing Mode (which lets you enter text). If you are in Visual Mode (which is a selection mode), the &#8216;o&#8217; key moves you to the other end of the selection.I&#8217;ve heard some people say that this is a strike against Vim, but I have never had any problem with this.</li>
</ul>
<ul>
<li><strong>&lt;action&gt;&lt;location&gt;: </strong>Once Vim beginners have learned all of the basic ways to move through a document (forward/previous character, forward/previous word, forward/previous line, searching, beginning/end line, etc), the next big epiphany is that you can combine these searches with commands. &#8216;dw&#8217; deletes to the beginning of the next word. &#8216;d$&#8217; deletes to the end of the line. &#8216;dn&#8217; deletes to the next result in a search. The movements can be combined with commands to make complex text manipulation a piece of cake.Vim also comes with dozens of mnemonic commands, such as &#8216;daw&#8217; (&#8220;<strong>d</strong>elete <strong>a</strong> <strong>w</strong>ord&#8221;, deletes the word under the cursor, no matter where you started in the word).</li>
</ul>
<ul>
<li><strong>Easy Repetition: </strong>Vim makes repetition very easy. All you need to do is type a number before you enter the command, and Vim will repeat it that many times. Want to delete the next 6 lines? Type &#8217;6dd&#8217;. Delete 6 words? &#8217;6daw&#8217;.</li>
</ul>
<ul>
<li><strong>Quick Scripting: </strong>In Vim, this is one of the best timesavers available. If you have an action that you would like to do over and over again, you can store a key sequence in a buffer to recall later. For example, to start a macro, all you need to do is type &#8216;qa&#8217;, which will store a macro in the &#8216;a&#8217; buffer. To finish, type &#8216;q&#8217; again. To use the macro, type &#8216;@a&#8217;. To repeat it 100 times. type &#8217;100@a&#8217;. It&#8217;s that easy.</li>
</ul>
<ul>
<li><strong>Fast Search:</strong> Searching in Vim is fantastically easy: all you need to do is type &#8216;/&#8217;, and then type your search regular expression. Search and replace is a lot more arcane: &#8220;:%s/&lt;search regexp&gt;/&lt;replacement text&gt;/gc&#8221; will do a search and replace globally and ask you for confirmation for each replacement. This is a common theme: there is less overhead to executing Vim commands. Sure, there are exceptions, but the stuff you use 80% of the time has been optimized for time.</li>
</ul>
<ul>
<li><strong>Tabs, Buffers, Frames, Windows:</strong> All of the goodies you could ever ask for in this category. You have access to all of the standard ways to move data around. Miss buffers from Emacs? You get to use them in Vim. Miss tabs from Visual Studio? Type &#8220;:tabe&#8221; and use the tabs. Do you like having split screen code? You get that, too.</li>
</ul>
<ul>
<li><strong>Customizable:</strong> Vim has its own scripting language that allows coders to build extensions. The site has a few thousand extensions that have been developed by the community, but I&#8217;ve always found it difficult to navigate.</li>
</ul>
<p><strong>Disadvantages</strong></p>
<ul>
<li><strong>Chokes to death on multiple long lines: </strong>When I mean long, I&#8217;m not saying that Vim is a little slow on lines with 100 characters. If you had a file with multiple lines larger than the screen size (if you had a file of DNA sequences, for instance), you will probably not get the display behavior that you want with the default settings.</li>
</ul>
<ul>
<li><strong>The Learning Curve: </strong>When you finally get up to speed using Vim, it is fantastic. However, it will take you a few weeks before you get used to all of the new commands, and even longer before you stop mixing up the movement keys and the home row. However, this is the kind of tool that is optimized for experts and not beginners.</li>
</ul>
<ul>
<li><strong>Don&#8217;t Sneeze and Type:</strong> Have you ever started typing a sentence while in command mode and not in insert mode? Me too. I&#8217;ve watched half of my file disappear before my very eyes. Fortunately, the undo key (&#8216;u&#8217;) is not very far away.</li>
</ul>
<h2>Emacs</h2>
<p><em><span style="text-decoration: underline;">Disclaimer</span>: So that I don&#8217;t summon RMS from the depths of the Marianas Trench, mentally replace all instances of &#8220;Emacs&#8221; with &#8220;GNU Emacs&#8221;. It&#8217;s easier to type, and everyone knows what I meant, dammit.</em></p>
<p>Note: In key sequences, &#8220;C&#8221; means &lt;Ctrl&gt; and &#8220;M&#8221; means &lt;Alt&gt;. So C-M-Del means &#8220;&lt;Ctrl&gt;&lt;Alt&gt;&lt;Del&gt;&#8221;</p>
<p><strong>Advantages</strong></p>
<ul>
<li><strong>Easier to Learn</strong>: Emacs has a better learning curve than Vim, as the user is automatically able to start typing. It&#8217;s not until they try to save that they run into their first problem. However, the file menu helpfully gives the users the proper command.</li>
</ul>
<ul>
<li><strong>Many Commands</strong>: Emacs has quite a bit of built in commands. To me, it seems like it has more than Vim, but that could just be a shortcoming of mine. It has a lot of helpful commands that Vim doesn&#8217;t have built in, such as transposition. This allows you to drag a word forward or backwards in a sentence or an argument list.</li>
</ul>
<ul>
<li><strong>Everything but the Kitchen Sink: </strong>The main beauty of Emacs is that you shouldn&#8217;t need to leave your text editor in order to perform mundane tasks related to coding. Sure, Vim lets you compile and debug from the editor, but Emacs lets you check email, use calculators, play games. You can also perform any programming-related task you&#8217;d like. If you know a little eLisp (Emacs Lisp), you can even evaluate Lisp expressions inside of Emacs <em>by default</em>.</li>
</ul>
<ul>
<li><strong>Better Auto-Indent</strong>: It seems like the coding modes in Emacs understand the document structure of programs a lot better, as they get tabbing right very frequently. Some of the modes are also intelligent when there is a tabbing ambiguity. For instance, in the Python writing mode, pressing the &lt;Tab&gt; key multiple times gives you all of the different possible legal tab positions.</li>
</ul>
<ul>
<li><strong>Great Extension Community:</strong> Combining the magic of Lisp with the magic of Emacs, the community has been writing every imaginable extension you can think of since the mid &#8217;80s.</li>
</ul>
<ul>
<li><strong>Good Copy/Cut Behavior: </strong>By default, the copy/cut buffer in Emacs goes through &#8220;rings&#8221;, where you can repeatedly hit M-y in order to get previous items in the copy buffer. In Vim, you need to specify which buffer should be used as a copy, as it will continually overwrite the same one.</li>
</ul>
<ul>
<li><strong>Good Buffer Support: </strong>Once you learn the different buffer commands, they turn out to be a very powerful way to switch documents. You can open new buffers as a scratch pad and turn to old ones in the blink of an eye.</li>
</ul>
<p><strong>Disadvantages</strong></p>
<ul>
<li><strong>Ragtime Typing: </strong>Due to the use of modifier chords, you have to move your hands around quite a bit. The most commonly used key is the &lt;Ctrl&gt; key, so if your keyboard only has one, it is recommended that you swap your &lt;Ctrl&gt; and &lt;Caps Lock&gt; keys. For most of the simple movement, you need to use two keys to move instead of one: C-f to move forward, for instance.</li>
</ul>
<ul>
<li><strong>Emacs Pinky:</strong> After a few weeks of use, I actually started getting the dreaded &#8220;Emacs Pinky&#8221;, a numb sensation in the pinky from constant use of the modifier keys. I took it easy for a few days and wore a wrist brace to find out when I&#8217;ve been abusing hand stretches, and the problem has since disappeared. However, the phenomena is very real, so be careful.</li>
</ul>
<h2>Somewhere There Is a Great Text Editor</h2>
<p>Both of the text editors mentioned here have a lot of great features, but they also have a lot of drawbacks that are not mentioned here. Some certain commands have a lot more overhead then they should. Granted, you can just rebind keys to the command you want. However, this doesn&#8217;t always work when you are bouncing back-and-forth between a lot of different computers.</p>
<p>It would be great if Vim had the &#8220;kitchen sink&#8221; philosophy of Emacs built in, because then I&#8217;d never have to leave Vim and could forever revel in its modal glory. A lot of the buffer/window/tab commands in Vim feel like they have too much typing overhead. For example, typing &#8220;:tabn&#8221; over and over again to switch tabs gets old.</p>
<p>In turn, it would be great if Emacs had a lot less typing overhead for some of its commands. Viper (using VI bindings in Emacs) is a fair compromise, but it somehow feels cheap, and doesn&#8217;t really get away from the Ragtime Typing problem for anything but the most common movements.</p>
<p>In general, I&#8217;ve found that Emacs is a better writer than Vim, as it understands the structure of the document much better. However, I&#8217;ve found that Vim is a much better editor: I can perform a lot of the common editing commands a lot faster in Vim than in Emacs. It&#8217;s missing a few, like word dragging, but that is easily replaced by deleting the word and retyping it in the necessary location.</p>
<p>I think that a great text editor would have the following criteria:</p>
<ul>
<li>Modal (helps cut down on keystrokes).</li>
<li>Low typing overhead for 99% of the most common editing tasks.</li>
<li>Easy on the C-M chord modifiers for the common tasks.</li>
<li>&#8220;The Kitchen Sink&#8221; philosophy. The programmer should never need to leave the editor to do common tasks like check email, the weather, their RSS reader, play basic games, etc.</li>
<li>Great understanding of the document structure, not just best-guessing the tabbing like Vim does.</li>
<li>Easy tabs/buffers/frames/windows.</li>
<li>Great integration with OS and local tools.</li>
</ul>
<p>Anything else?</p>
<img src="http://www.jakevoytko.com/blog/?ak_action=api_record_view&id=70&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.jakevoytko.com/blog/2008/04/13/somewhere-between-vim-and-emacs-there-is-a-great-text-editor/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>
