<?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>KunalB &#187; Web Design</title>
	<atom:link href="http://kunal-b.in/category/teck/web-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://kunal-b.in</link>
	<description>Yet another way to learn.</description>
	<lastBuildDate>Sat, 17 Jul 2010 04:06:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Editors for Coding?</title>
		<link>http://kunal-b.in/2010/07/editors-for-coding/</link>
		<comments>http://kunal-b.in/2010/07/editors-for-coding/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 21:44:47 +0000</pubDate>
		<dc:creator>kunalb</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[web designing]]></category>

		<guid isPermaLink="false">http://kunal-b.in/?p=31</guid>
		<description><![CDATA[So today’s post begins with a question: what editor is your favourite? Do you have separate editors based on different contexts (eg. Netbeans for Java, Dreamweaver for sites), or do you tend to stick to a single Man Friday to fulfill all your needs? Do you prefer IDEs or simple text editors? My answer for [...]]]></description>
			<content:encoded><![CDATA[<p>So today’s post begins with a question: what editor is your <em>favourite</em>? Do you have separate editors based on different contexts (eg. Netbeans for Java, Dreamweaver for sites), or do you tend to stick to a single Man Friday to fulfill all your needs? Do you prefer IDEs or simple text editors?</p>
<p>My answer for the above questions:</p>
<p>I <em>love</em> gVIM (graphical VIM). I’ve set it up to work over SSH in Windows (I work on a different box and merely use my laptop as a convenient interface), hidden all menu bars and installed a colour theme pack of which I’m currently using “Evening”. And I’ve started using VIM for <em>every</em> code related task I do. In defence of my choice, allow me to introduce some of the basic functionality included in VIM and some practical use cases: (Not intended as a tutorial, but a quick glimpse at the great functionality on offer)</p>
<ol>
<li><strong>Simple Editing<br />
</strong>Typographical errors are the programmer’s bane. And if they’re not shown as errors (occasionally the case with various Javascript libraries), life becomes hell. Quick correction options in vim:</p>
<ul>
<li><strong>dw, dd, etc.</strong> Basically, both for deleting and cutting text. dw deletes till the end of the line. d2w deletes 2 words. dd deletes the current line. Entering %d on the command line (i.e. using : ) deletes the full file. D deletes until the end of the current line. Considering standard equivalents, I’m always astonished by what I can accomplish so quickly in VIM.<br />
<em>I really tend to use d…d to quickly get rid of large chunks of commented code. Or simply for moving code around very very quickly.</em></li>
<li><strong>r, rw, etc. </strong>d was for delete. r is for replace. Need I elaborate?<br />
<em>I tend to mis-type certain words a lot. Really easy for me to just go over the offending character and type in rx, where x is the new character I want to replace it by.</em></li>
<li><strong>o, i, a, A, etc.</strong> Single keypresses for: 0: add a new line after current one and start editing, O: add a new line before the current line and start editing, a: start appending after cursor, i: start inserting before cursor, A: insert stuff at end of the current line.<br />
<em>A is the forgetful programmer’s boon. Really useful for adding ; at the end of lines.</em></li>
</ul>
</li>
<li><strong>Editing over scp/ftp/etc.<br />
</strong>Vim comes with a special plugin (NetRW) that lets you quickly edit files over your protocol of choice. I regularly use<br />
<em>:e scp://&lt;username&gt;@&lt;host&gt;/path/<br />
</em>to get a directory listing of all the files in that path; choose your file and edit away.</li>
<li><strong>Search and replace<br />
</strong>Ever changed a variable at the last minute and had to change it? Easily carry out regular expressions over very simply defined yet <em>complex</em> range of lines using /&lt;pattern&gt;/ or :s/&lt;pattern&gt;/&lt;substitute&gt;/flags. You can even carry out commands on matching portions. One of the most useful features I’ve used once I got the hang of it.</li>
<li><strong>Ranges<br />
</strong>Vim’s flexibility in terms of defining ranges for substitution/deletion/anything you’d care to mention is amazing. One of the features I most constantly use is ‘<em>marks’</em> that allow you to mark certain positions to be easily referenced later.</li>
<li><strong>Too many colour themes</strong><br />
The amount of possible colour themes available is astonishing. And allows a <em>UI freak </em>like me to be completely satisfied with what I’m coding in. And switching quickly when I want to.</li>
<li><strong>Registers<br />
</strong>Registers allow you to cut/copy and store stuff in different named “registers and then paste where and when you want. Anyone who’s shuffled through various files can easily comprehend the huge help this is.</li>
<li><strong>Buffers and Tabs<br />
</strong>Tabs are essential to any decent program today. Buffers are tabs without the graphical interface indicating their presence. The best part is while using Vim in linux I tend to use<br />
<em>gVIM –p *.php<br />
</em>and other such commands to quickly open all files of  a single type in tabs in a single window. Really makes finding the right file much much easier.</li>
<li><strong>Sessions<br />
</strong>Using :mksession and :source allow you to quickly open all the files you had open the last time you sat down to work. And as you get to choose where the file containing the session is saved, handling sessions becomes really simple and easy.</li>
<li><strong>Abbreviations<br />
</strong>How many times do you find yourself using common stuff like console.log() or error_log() while debugging? Just use the command<br />
<em>:ab cl console.log<br />
</em>and every time you type cl( (followed by a space/newline/./(/etc.) it will be automatically expanded. I imagine you can see the possibilities. Interestingly, abbreviations can be saved in sessions so if you don’t want to keep an abbr. around for a long time, or have something specific (such as a class name) just use and save it in the session.</li>
<li><strong>Key Mapping<br />
</strong>Map keys to carry out your most often used commands.</li>
<li><strong>An awesome community<br />
</strong>There are thousands of sites out there with pointers on using VIM as well as an excellent Vim tips twiki. Be sure to check out the <a href = "http://vim.wikia.com/wiki/Main_Page">VIM tips twiki</a> and this <a href = "http://gravitonic.com/files/talks/vancouver-2007/vim-for-php-programmers.pdf">presentation on VIM for PHP programmers</a> by Andrei Zmievski to get a much better idea of what VIM is capable of. </li>
</ol>
<p> Also, for those of you who edit a lot of stuff on the web (using text boxes), install <a href = "https://addons.mozilla.org/en-US/firefox/addon/4125">It’s all text</a> to edit any text box’s contents using your favourite editor (VIM, anyone?). This post was written in <a href = "http://www.vim.org">gVIM</a>, opened via “It’s all text” on the excellent blogging platform provided by <a href = "http://www.wordpress.org">WordPress</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kunal-b.in/2010/07/editors-for-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
