<?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>Swaroop C H - India, Technology, Life Skills &#187; Vim</title>
	<atom:link href="http://www.swaroopch.com/blog/category/tech/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swaroopch.com</link>
	<description>Conning people into thinking I&#039;m intelligent. Since 1982.</description>
	<lastBuildDate>Sat, 04 Feb 2012 19:52:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My Bash and Vim setups</title>
		<link>http://www.swaroopch.com/blog/bash-vim-setup/</link>
		<comments>http://www.swaroopch.com/blog/bash-vim-setup/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 03:15:32 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[A Byte of Vim]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[bash-vim-setup]]></category>

		<guid isPermaLink="false">http://www.swaroopch.com/?p=3321</guid>
		<description><![CDATA[I find it surprising on how little time coders spend on their development environment (the "dev env"). A good dev env is necessary for any coder because we do searching, refactoring, editing and updating of code more than just appending new code.]]></description>
			<content:encoded><![CDATA[<p>I find it surprising on how little time coders spend on their development environment (the &#8220;dev env&#8221;). And especially, I find it amusing that I can find, refactor and test code way faster than the Netbeans IDE users in my office, with just a shell and Vim setup.</p>

<p>So why is a good dev env necessary? Because we do searching, refactoring, editing and updating of code much more than appending fresh code, and this also applies to code that you wrote half an hour ago, because you will want to quickly refactor it when a new constraint, a new requirement, a new design or a new idea comes to your mind.</p>

<p>I learned this lesson while I was writing my <a href="http://www.swaroopch.com/notes/Vim">Vim book</a>. Since then, I have been investing quite a bit of time on my <code>vimrc</code> file, heavily customized to my liking.</p>

<p>To give one very quick example &#8211; I like the cursor to always be at the middle of the window (as opposed to at the bottom of the screen when you&#8217;re scrolling down), so that I can see the lines of code before and after the current line. To achieve this, you simply <a href="http://vimhelp.appspot.com/options.txt.html#%27scrolloff%27">set scrolloff=999</a> and you&#8217;re done. A one-line setting, but it makes a world of difference in usage.</p>

<p>Extrapolate this to dozens of customizations and you have just optimized your environment for lesser time at the keyboard, lesser time fighting the editor, and more time on the actual code. You do <em>not</em> want to break your flow of thought because you&#8217;re unable to quickly switch between the right files (say, between the controller and the view files), and so on. <a id="fn1-text" href="#fn1">[1]</a></p>

<p>These customizations are stored in <code>.vim</code> and <code>.bashrc</code> files, collectively referred to as &#8220;dotfiles&#8221;. I have been asked quite a few times by readers of my book to share my dotfiles, but I was not comfortable to share it because I felt it was too hacked up and did not have a good &#8220;base&#8221;.</p>

<p>So when I came across <a href="https://github.com/revans/bash-it">bash-it</a> and <a href="https://github.com/MarcWeber/vim-addon-manager">vim-addon-manager</a>, I knew they were good foundations and a good excuse for me to overhaul my bash and vim setups.</p>

<p><strong>And lo, behold, my <a href="https://github.com/swaroopch/dotbash">dotbash</a> and <a href="https://github.com/swaroopch/dotvim">dotvim</a> repos</strong> (on GitHub).</p>

<p>These are my actual working environments at office and on my personal laptop, so if you don&#8217;t agree with some of my defaults, fork away.</p>

<p>Now, on to what is interesting about my setup&#8230;</p>

<h2>What bash-it provides</h2>

<p><a href="https://github.com/revans/bash-it">bash-it</a> provides great defaults and aliases, right from <code>..</code> as a shortcut for <code>cd ..</code> and <code>...</code> for <code>cd ../..</code> to bash completion setups for git, rake, etc., and of course, a gorgeous theme to use:</p>

<p><img src="http://farm6.static.flickr.com/5166/5233776966_1f9cae40ac.jpg" width="500" height="106" alt="Bash prompt" title="Bash prompt provided by bash-it"/></p>

<p>The best part though is it&#8217;s neat organization into aliases, completion, custom, lib, plugins, themes and template folders. That makes a big difference in the long run, for the same reasons why a cleanly modularized codebase is better than one giant script.</p>

<p>And it will get various new features over time contributed by the community, example, <a href="https://github.com/revans/bash-it/pull/31">completion of server names for ssh</a>.</p>

<h2>What vim-addon-manager provides</h2>

<p><a href="https://github.com/MarcWeber/vim-addon-manager">vim-addon-manager</a> provides a super-simple way to install plugins into separate folders and then use them all, instead of lumping all of them together into a <code>.vim</code> folder. Just add the name of a new Vim plugin to the list of plugins you want to load, and it will automatically fetch the plugin and install it for you! This makes it easy to play around with new plugins as well as a simple way of having the latest version of the Vim plugins.</p>

<p>I use <code>vim-addon-manager</code>, but there are alternatives &#8211; others prefer <a href="http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/">pathogen.vim</a> and there is also <a href="https://github.com/c9s/Vimana">Vimana</a> which gives you an <code>apt-get</code>-like command to search for Vim plugins. Choose your weapon.</p>

<p>There are caveats to vim-addon-manager, mainly that all plugins don&#8217;t seamlessly work with it. For example, I couldn&#8217;t get <a href="https://github.com/kevinw/pyflakes-vim">pyflakes.vim</a> to work with it, so I had to unzip pyflakes into my regular <code>.vim</code> directory to use it.</p>

<h2>My Bash customizations</h2>

<p>Ever since I saw <a href="http://gemedit.rubyforge.org/">gemedit</a>, I wanted something like that for Python eggs, and I realized that it was easy because Python modules have a <code>__file__</code> attribute that I can use, and I <a href="https://github.com/swaroopch/dotbash/blob/develop/plugins/python.plugin.bash">created my own egg_edit command</a> to do the same trick. Similarly, I have my own <a href="https://github.com/swaroopch/dotbash/blob/develop/plugins/rsync.plugins.bash">sync command</a> with the settings that I prefer, etc.</p>

<h2>tmux setup</h2>

<p>tmux is a modern alternative to GNU Screen which is a common arsenal in any Unix coder&#8217;s war-chest. I prefer to use tmux because it makes it easy to <a href="http://toastdriven.com/fresh/scripting-tmux/">script sessions</a> which makes it super-easy to start a new session working on a project. <a href="https://gist.github.com/728896">For example</a>:</p>

<script src="https://gist.github.com/728896.js?file=flask-boilerplate-tmux.bash"></script>


<p>Put this as <code>flask-boilerplate-tmux.bash</code> into the <code>custom</code> folder of your bash-it/dotbash folder, and then you can run <code>flask-boilerplate-tmux</code> any time to start a new session to work on the <a href="https://github.com/swaroopch/flask-boilerplate">flask-boilerplate</a> codebase! ( <strong>Update</strong> : Check out <a href="https://github.com/remiprev/teamocil">Teamocil</a> which will allow you to do the same with a simple yaml config file )</p>

<p>I have a highly customized <a href="https://github.com/swaroopch/dotbash/blob/develop/configs/tmux.conf">tmux configuration</a> which sets many good default settings, especially starting the numbering of the windows from 1 (switching between 0 and 1 is painfully because they are at the opposite ends of the keyboard).</p>

<h2>autojump</h2>

<p>A good Bash plugin to use is <a href="https://github.com/joelthelion/autojump/wiki">autojump</a> which monitors which directories you spend most of your time in, and then makes it easy to jump to your most favorite directories using a simple <code>j</code> command.</p>

<p>Don&#8217;t forget to use <code>jumpstat</code> to see which are those directories. Also, bash-it/dotbash provides a command called <code>rh</code> that does something similar.</p>

<p>Note that I have started using autojump only recently, so I don&#8217;t have as much experience using it as the other tools.</p>

<h2>My Vim customizations</h2>

<p>I have a <a href="https://github.com/swaroopch/dotvim/blob/develop/vimrc">fairly customized vimrc</a>, right from changing the status line to providing shortcuts like <code>:A</code> to copy the full buffer to the clipboard and <code>:B</code> for vice-versa, which I find it very useful in situations such as I am writing this article in Vim and can quickly copy/paste into WordPress when I am done with the draft. I also have a <code>\o</code> shortcut to open a URL that the cursor is on, and many other goodies.</p>

<h2>Vim plugins I use</h2>

<p>There are three Vim plugins which are must-have for me:</p>

<p>First is <a href="https://github.com/wincent/Command-T">command-t.vim</a> which is a &#8220;fuzzy finder&#8221; to quickly jump to another file under the current directory.</p>

<p><a href="http://www.flickr.com/photos/swaroop/5233230695/" title="command-t.vim"><img src="http://farm6.static.flickr.com/5208/5233230695_9ecc335091.jpg" width="500" height="254" alt="command-t.vim" /></a></p>

<p>Second is <a href="https://github.com/mileszs/ack.vim">ack.vim</a> which allows you to intelligently grep your source code for patterns and then jump to each occurrence in a split-window fashion.</p>

<p>My favorite feature is that I can search my code with <code>:Ack --python</code> or <code>:Ack --ruby</code> and it will ignore all the JavaScript libraries which can have the same variable or function names.</p>

<p><a href="http://www.flickr.com/photos/swaroop/5233827526/" title="ack.vim"><img src="http://farm6.static.flickr.com/5162/5233827526_3d1ca6f24b.jpg" width="500" height="255" alt="ack.vim" /></a></p>

<p>Third is <a href="http://code.google.com/p/conque/">conque shell</a> which allows you to to create a split window which can be any interpreter prompt.</p>

<p>The best part is that you can use a shortcut <code>\e</code> (assuming the default mapleader) to send the visually selected text to the interpreter prompt as if it was copy-pasted and it will execute it! This is incredibly helpful when you want to iterate the development of a multi-line function or fragment of code and you find extracting that code to a separate file and editing that file to be a pain (The interpreter prompts are designed for playing around with one-liners, they are simply not built for multi-line code).</p>

<p><a href="http://www.flickr.com/photos/swaroop/5233830908/" title="conqueshell.vim"><img src="http://farm6.static.flickr.com/5282/5233830908_db98206cdd.jpg" width="500" height="256" alt="conqueshell.vim" /></a></p>

<p>I have the following lines in my vimrc to quickly create ConqueShell sessions:</p>

<pre><code>command Shell :set nolist | ConqueTermSplit bash
command PythonShell :set nolist | ConqueTermSplit python
</code></pre>

<p>So, I quickly run <code>PythonShell</code> to create a new session.</p>

<h2>Setups by others</h2>

<p>For other Vim setups, see the <a href="https://github.com/carlhuda/janus">Janus repo on GitHub</a> which is used by Yehuda Katz himself. You&#8217;ll find many more on <a href="http://dotfiles.org/.vimrc">the dotfiles website</a>.</p>

<h2>Summary</h2>

<p>I&#8217;m hoping this article will help Vimmers and Bash users to broaden their usage and help them be more productive, the same intention behind my Vim book:</p>

<blockquote><p>&#8220;I used to play with vim for years. I think <a href="http://www.swaroopch.com/notes/Vim">this book</a> would have to save me much time if it was written 10 years ago! Anyways, thank you for this amazing work you are doing.&#8221;</p>

<p>&#8211; turky_samy (at) hotmail (dot) fr</p></blockquote>

<p>If you like what you have read so far, then go ahead and <a href="https://github.com/swaroopch/dotbash#readme">install dotbash</a> and <a href="https://github.com/swaroopch/dotvim#readme">install dotvim</a>.</p>

<p>Bottom line:</p>

<blockquote><p>&#8220;Give me six hours to chop down a tree and I will spend the first four sharpening the axe.&#8221;</p>

<p>&#8211; Abraham Lincoln</p></blockquote>

<br />


<hr />

<p><a id="fn1" href="#fn1-text">[1]</a> The flip side though is that I have been told &#8220;You&#8217;re the most mysterious guy in this office. No one understands what you&#8217;re doing when we see you coding.&#8221; Heh. Hopefully, it is not as mysterious after this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/bash-vim-setup/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Great response to &#8216;A Byte of Vim&#8217;</title>
		<link>http://www.swaroopch.com/blog/response-to-vim-book/</link>
		<comments>http://www.swaroopch.com/blog/response-to-vim-book/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 05:23:19 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[A Byte of Vim]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://www.swaroopch.com/?p=1035</guid>
		<description><![CDATA[It has been three days since I released my Vim book. I&#8217;m very happy with the response. For starters, there has been 5003 PDF downloads, 14,715 unique visitors and 35,129 page views. That&#8217;s in just three days! Second, I&#8217;m glad to see the kind of responses that I was hoping for: [@raseel](http://twitter.com/raseel/status/1024291090) says &#8220;Great Book [...]]]></description>
			<content:encoded><![CDATA[<p>It has been three days since I released my <a href="http://www.swaroopch.com/notes/Vim">Vim book</a>. I&#8217;m very happy with the response.</p>

<p>For starters, there has been <strong>5003 PDF downloads, 14,715 unique visitors and 35,129 page views</strong>. That&#8217;s <strong>in just three days</strong>!</p>

<p>Second, I&#8217;m glad to see the kind of responses that I was hoping for:</p>

<blockquote markdown="1">
[@raseel](http://twitter.com/raseel/status/1024291090) says &#8220;Great Book !! Although I use vim everyday as an editor as well as an ide, the book makes u realise how much more it can do.&#8221;
</blockquote>




<blockquote markdown="1">
[@techpickles](http://twitter.com/techpickles/status/1025775542) says &#8220;have been thumbing through &#8216;byte of vim&#8217;. learning a ton even having used vim for years.&#8221;
</blockquote>


<p>I&#8217;m happy to see people discovering that Vim can do more, <a href="http://www.swaroopch.com/notes/Vim_en:Table_of_Contents">way more</a> than people know about. There is a lot of power underneath the hood and it is a tragedy that it goes unnoticed even by long-time Vim users. Years ago, I started to wonder if I could change that situation and that&#8217;s when I started writing the book.</p>

<p>Regarding the responses via Twitter, it was interesting to see how fast the information was spreading. I could see retweets (linking to the book) being passed on from someone in Switzerland to someone in Ireland to someone in USA and so on, in quick succession.</p>

<p>Most of the traffic came from <a href="http://www.reddit.com/r/programming/comments/7fhix/a_free_book_on_vim/">Reddit</a> and <a href="http://news.ycombinator.com/item?id=377278">Hacker News</a>, so many thanks to those readers who submitted the news to these discussion sites. Seeing &#8216;A Byte of Vim&#8217; as the top link on Hacker News for more than a day put me on a geek high.</p>

<p>Most of the feedback was from the <a href="http://groups.google.com/group/vim_use/browse_thread/thread/a525fc8ffcc13b82/220128947ee95a83#220128947ee95a83">vim.org mailing list</a> where people were really happy to see the news. I&#8217;ve added some of these feedback to the <a href="http://www.swaroopch.com/notes/Vim#What_Readers_Say">What Readers Say</a> section of the book&#8217;s front page.</p>

<p>There has been a lot of contributions to the wiki in terms of &#8220;bug fixes&#8221; i.e. typo corrections, grammar corrections and procedure corrections. It feels like a ton of editors are holding a magnifying glass to the book <img src='http://www.swaroopch.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>One of the more exciting mails I received was from <a href="http://www.swaroopch.com/notes/User:Yesyo">Yeh, Shih-You</a> who wanted to start a <a href="http://www.swaroopch.com/notes/Vim_zh-tw:%E7%9B%AE%E9%8C%84">Chinese translation</a>! He said:</p>

<blockquote>
My name&#8217;s Yeh, Shih-You, a programmer and a Linux-lover from Taiwan. Having been using Vim for about 3 years, I found out that getting the most out of Vim suddenly becomes a necessity, in order to improve productivity as well as efficiency. Your book came out at the perfect time.
<br /><br />
I&#8217;m interested in contributing translations in Traditional Chinese. Thanks for all the effort you&#8217;ve put into this book.
</blockquote>


<p>Now <em>that</em> is awesome.</p>

<p>On a side note, it&#8217;s amazing to note that even for my <a href="http://www.swaroopch.com/notes/Python">previous book</a>, the number of mails from Chinese readers have increased dramatically in the past couple of years. So, in a way, I shouldn&#8217;t have been surprised that the Chinese translation was the first one to be started for the new book as well. The Chinese guys are already on the forefront of hardware manufacturing, but now seeing firsthand that they are so hungry to learn and devouring information online, it is hard not to imagine them at the forefront of software in a few years as well.</p>

<p>To sum it up, I&#8217;m happy with the response, although I would&#8217;ve been happier if a good number of <a href="http://www.swaroopch.com/buybook">print copies</a> were sold, as well as more community contributions in terms of content such as new topics and chapters.</p>

<p>Many people are surprised and curious on why I choose to release my book under a Creative Commons license, I shall explain that in a different post later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/response-to-vim-book/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Announcing my free book on Vim</title>
		<link>http://www.swaroopch.com/blog/a-free-book-on-vim/</link>
		<comments>http://www.swaroopch.com/blog/a-free-book-on-vim/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 02:54:40 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[A Byte of Vim]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Getting Things Done]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[fossdotin]]></category>

		<guid isPermaLink="false">http://www.swaroopch.com/?p=994</guid>
		<description><![CDATA[Today is the first day of foss.in/2008, and on this occasion, I&#8217;m happy to announce the first public release of my Creative-Commons licensed book on the Vim 7 editor. This book is meant for both beginners and advanced users. For beginners, it walks you through the first steps to learning about modes, discusses about typing [...]]]></description>
			<content:encoded><![CDATA[<p>Today is the first day of <a href="http://foss.in">foss.in/2008</a>, and on this occasion, I&#8217;m happy to announce <a href="http://www.swaroopch.com/notes/Vim">the first public release of my Creative-Commons licensed book on the Vim 7 editor</a>.</p>

<p>This book is meant for both beginners and advanced users.</p>

<p>For beginners, it walks you through the <a href="http://www.swaroopch.com/notes/Vim_en:First_Steps">first steps</a> to learning about <a href="http://www.swaroopch.com/notes/Vim_en:Modes">modes</a>, discusses about <a href="http://www.swaroopch.com/notes/Vim_en:Typing_Skills">typing skills to be effective</a> and moves on to the <a href="http://www.swaroopch.com/notes/Vim_en:Moving_Around">editing basics</a>.</p>

<p>This book will definitely appeal more to people who are Vim users already because it helps add a huge number of tricks to their arsenal, whether it is <a href="http://www.swaroopch.com/notes/Vim_en:More_Editing">more efficient editing</a>, <a href="http://www.swaroopch.com/notes/Vim_en:Personal_Information_Management">personal information management</a>, <a href="http://www.swaroopch.com/notes/Vim_en:Scripting">coding</a> your own <a href="http://www.swaroopch.com/notes/Vim_en:Plugins">plugins</a> or making Vim a <a href="http://www.swaroopch.com/notes/Vim_en:Programmers_Editor">programmers&#8217; editor</a>.</p>

<p>I hope that fellow Vimmers will find these notes useful. Even though it is in a book format, the writing style is more like a tutorial and is informal, which should be familiar to readers of my <a href="http://www.swaroopch.com/notes/Python">Python book</a>.</p>

<p>Both books are under the <a href="http://www.swaroopch.com/notes/Vim_en:Preface#License_and_Terms">Creative Commons Attribution-ShareAlike 3.0 license</a>, so you&#8217;re free to <a href="http://www.swaroopch.com/notes/Vim#Download">download it</a>, email it, share it and improve it. In fact, <a href="http://www.swaroopch.com/notes/Vim">the book is on a wiki</a>, so you can just click on &#8216;Edit&#8217; in the left sidebar of any chapter to improve the book in a matter of seconds. When in doubt, please use the &#8216;Discussion&#8217; link to add your suggestions and comments.</p>

<p>For those who prefer reading books they can hold in their hand, please consider <a href="http://www.swaroopch.com/buybook">purchasing a printed copy of the book</a>. This will also help support the continued development of the book.</p>

<p>For those PHP gurus familiar with GeSHi syntax highlighting, I would greatly appreciate any help in <a href="http://www.swaroopch.com/files/byteofvim/vim.phps">improving my vim syntax highlighting source</a>, especially in handling Vim-style comments, etc. Please <a href="http://www.swaroopch.com/contact/">mail me</a> if you can help.</p>

<p>This book has been in the works for several years, so I&#8217;m glad to see it finally in good enough <a href="http://www.swaroopch.com/notes/Vim_en:Feedback">shape</a> for releasing it. Although I haven&#8217;t done as many rewrites as I would have been satisfied with, I decided it was better to &lt;insert cliché of &#8220;Release Early, Release Often.&#8221;&gt;</p>

<p>I <a href="http://www.swaroopch.com/notes/Vim_en:Colophon#Inspiration">dedicate</a> this release to foss.in and <a href="http://www.swaroopch.com/gtdbook">GTD principles</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/a-free-book-on-vim/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Effective Vim</title>
		<link>http://www.swaroopch.com/blog/effective-vim/</link>
		<comments>http://www.swaroopch.com/blog/effective-vim/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 15:27:13 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://www.swaroopch.com/archives/2007/11/16/effective-vim/</guid>
		<description><![CDATA[Being a fan of Steve Yegge, I was randomly reading some of his older writings and eventually chanced upon his post on &#8220;Effective Emacs&#8221;. Being a Vim guy, I wondered whether some of the tips he presents are useful for the Vim world as well. Note: This is not a Vim vs Emacs thing, it [...]]]></description>
			<content:encoded><![CDATA[<p>Being a fan of <a href="http://steve-yegge.blogspot.com">Steve Yegge</a>, I was
randomly reading some of his older writings and eventually chanced
upon his post on <a href="http://steve.yegge.googlepages.com/effective-emacs">&#8220;Effective
Emacs&#8221;</a>. Being
a Vim guy, I wondered whether some of the tips he presents are useful
for the Vim world as well.</p>

<p>Note: This is <em>not</em> a Vim vs Emacs thing, it is simply a porting of
tips for Emacs to see whether the tips are useful for Vim users as
well.</p>

<p>So here goes:</p>

<h2>10 Specific Ways to Improve Your Productivity With Emacs, ported to Vim:</h2>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item1">Item 1</a>: Swap Caps-Lock and Control</h3>

<p>This is a desktop-specific customization. <s>However, I don&#8217;t think it is
required for Vim users, but <a href="http://vim.wikia.com/wiki/Swap_caps-lock_and_control_keys_using_MS_Windows_Registry">it can be
useful</a>.</s></p>

<p><em>Update</em>: After using for a couple of days, I&#8217;m really starting to like this!</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item2">Item 2</a>: Invoke M-x without the Alt key</h3>

<p>Not relevant for Vim. Not a good start, first two tips are out&#8230;</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item3">Item 3</a>: Prefer backward-kill-word over Backspace</h3>

<p>This is a good tip. Normally, I would use <code>bdw</code> to achieve the same.
To map backspace to this command in normal mode, put this in
your vimrc: <code>:map &lt;bs&gt; bdw</code>.</p>

<p>To make it work in insert mode you can put <code>:imap &lt;bs&gt; &lt;esc&gt;bdwa</code>. I&#8217;m
sure there&#8217;s a better way to use just one command to do this, please
leave a comment if you know of a better way.</p>

<p> <em>Update</em>: You can also use <code>ctrl-w</code> in insert mode (see <code>:help i_CTRL-W</code>),
thanks to <a href="http://programming.reddit.com/info/60slg/comments/c02heg3">pimaniac</a>.</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item4">Item 4</a>: Use incremental search for Navigation</h3>

<p>Use <code>:set incsearch</code>. <br />
Press <code>n</code> to search forward and <code>N</code> to search backward.</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item5">Item 5</a>: Use Temp Buffers</h3>

<p>Run <code>:new</code> to get a new buffer (or alternately <code>ctrl-w n</code>). <br />
To switch between buffers, use <code>ctrl-w ctrl-w</code> (yes, twice). <br />
Use <code>:q</code> as usual to close the buffer (or alternately, <code>ctrl-w q</code>).</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item6">Item 6</a>: Master the buffer and window commands</h3>

<ul>
<li>To split window vertically, run <code>:vsp</code></li>
<li>To split window horizontally, run <code>:sp</code></li>
<li>To make all visible windows approximately equal height, run <code>ctrl-w =</code></li>
<li>To switch to other window, run <code>ctrl-w ctrl-w</code> or use the
directional keys <code>ctrl-w h/j/k/l</code></li>
<li>To delete other windows, use <code>ctrl-w o</code> or run <code> <img src='http://www.swaroopch.com/wordpress/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly</code></li>
<li>To list-buffers, run <code>:ls</code> (or even <code>:files</code> or <code>:buffers</code>)</li>
<li>Dialog Boxes: The Root of All Evil &#8211; agree, Vim doesn&#8217;t need dialog
boxes as well (at least in the non-gui mode)</li>
<li>Buffers to the Rescue &#8211; Same thing for Vim, I think.</li>
</ul>


<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item7">Item 7</a>: Lose the UI</h3>

<ul>
<li>Remove the menubar using <code>:set guioptions-=m</code>.</li>
<li>Remove the toolbar using <code>:set guioptions-=T</code>.</li>
<li>Similar options exist for the scrollbar, see <code>:help guioptions</code></li>
<li>Region selection can be easier in Vim using the visual mode, just
press <code>v</code>, use the normal keys to move around, such as <code>10j</code> to move
down by 10 lines, and then a command to work on that visual
selection, such as <code>d</code> to delete it.</li>
</ul>


<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item8">Item 8</a>: Learn the most important help functions</h3>

<p>The help in Vim is vast, see <code>:help usr_toc</code> to see the chapters of
the awesome reference manual.</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item9">Item 9</a>: Master Emacs&#8217;s regular expressions</h3>

<p>I agree, Friedl&#8217;s book is the authority on this. However, there are
some good <a href="http://www.geocities.com/volontir/">introductions to Vim regular
expressions</a> available.</p>

<h3><a href="http://steve.yegge.googlepages.com/effective-emacs#item10">Item 10</a>: Master the fine-grained text manipulation commands</h3>

<ul>
<li>Creating macros are easy in Vim. Press <code>qa</code> to start recording
a macro called &#8216;a&#8217;, do all the commands you want to run, pres <code>q</code> to
stop recording. Then, run <code>@a</code> to repeat the recorded commands i.e.
a macro.</li>
<li>Swapping two adjacent words, yeah, this can be better. I use <code>xp</code> to
swap characters and <code>dwwP</code> to swap words, but it doesn&#8217;t do fancy
stuff like the <code>transpose-*</code> functions. This can be an interesting
plugin to write.</li>
</ul>


<h3>Tune in next time&#8230;</h3>

<ol>
<li>Filling paragraphs can be done by setting <code>:set textwidth=80</code> and
running <code>gqap</code> command to format &#8216;a&#8217; &#8216;p&#8217;aragraph, or like me you
can map the &#8216;Q&#8217; key to run it : <code>:nmap Q gwap</code>. To make this work
inside comments, make sure you <code>:set formatoptions+=c</code>.</li>
<li>gnuserv : I use <a href="https://addons.mozilla.org/en-US/firefox/addon/4125">It&#8217;s All
Text!</a> Firefox
extension.</li>
<li>Dired : There are plugins available with
<a href="http://www.vim.org/scripts/script.php?script_id=798">similar</a>
<a href="http://www.vim.org/scripts/script.php?script_id=1721">functionality</a></li>
<li>Whitespace manipulation &#8211; plenty of ways such as <code>:set expandtab</code>,
<code>:retab!</code>, <code>:help fo-table</code>, etc.</li>
<li>nxml-mode : I haven&#8217;t used nxml-mode but I&#8217;m still looking for
something like Emacs&#8217; SGML-mode that works for Vim. I miss you,
SGML-mode.</li>
<li>picture-mode : Dr. Chip to the rescue with
<a href="http://vim.sourceforge.net/scripts/script.php?script_id=40">DrawIt.vim</a></li>
<li>minibuffer management : Not sure what this is.</li>
<li>effortless navigation : I think Vim has enough keys for this by
default. See <code>:help navigation</code>.</li>
<li>region management : We can always choose the color scheme of choice
for the highlighted region, or change it ourselves, see `:help

<pre><code>:highlight`.
</code></pre></li>
<li>rectangle commands : Use <code>ctrl-v</code></li>
<li>emacs shells : We have <code>:sh</code> but don&#8217;t know if Emacs does
something more</li>
<li>align-regexp : Not sure what this is.</li>
<li>frame initialization : I set Vim to always opens in full screen,
see <code>:help win16-maximized</code>. Not sure how to do it in Linux yet,
but in Gnome, I just press Alt-F10.</li>
<li>using the goal column : No idea&#8230;</li>
<li>setting the fill column : Nada&#8230;</li>
<li>OS settings and font : I like to customize Vim&#8217;s font and keep
<a href="http://www.smashingmagazine.com/category/fonts/">trying different
fonts</a>, currently
I&#8217;m using <code>:set guifont=Consolas:h14:cANSI</code></li>
<li>browsing and editing archives : I think Vim does this by default,
see <code>:help netrw</code>.</li>
<li>advanced keybinding : see <code>:help :map</code> and <code>:help keycodes</code></li>
<li>mastering the kill ring : I guess you can simulate this with
<code>:echo @a</code>, etc.</li>
<li>mastering Info : Not sure if this would be useful in Vim.</li>
<li>using M-x customize : Not sure what this does.</li>
<li>utility apps : It&#8217;s all in the <a href="http://www.vim.org/scripts/">plugins</a>.</li>
</ol>


<p>Summary: Porting good ideas is a good idea <img src='http://www.swaroopch.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<br />


<hr />

<p>I wonder why a search for Steve Yegge on Wikipedia points to
<a href="http://en.wikipedia.org/wiki/Special:Search?search=steve%20yegge&amp;fulltext=Search">Batman</a>&#8230;</p>

<br />


<hr />

<p><strong>Update in November end, 2008</strong>: <a href="http://www.swaroopch.com/notes/Vim">I have released a new book on Vim, read the whole thing right here.</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/effective-vim/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Lookup</title>
		<link>http://www.swaroopch.com/blog/lookup/</link>
		<comments>http://www.swaroopch.com/blog/lookup/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 17:35:49 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://www.swaroopch.com/archives/2007/08/25/lookup/</guid>
		<description><![CDATA[Most of my writing inside the browser is done with the combination of the It&#8217;s All Text extension and Vim. During this writing, I use words whose meaning I know vaguely but don&#8217;t know the exact usage, and in such cases, I usually open a new browser window and look up the meaning of the [...]]]></description>
			<content:encoded><![CDATA[<p>Most of my writing inside the browser is done with the combination of the <a href="https://addons.mozilla.org/en-US/firefox/addon/4125">It&#8217;s
All Text</a> extension and
Vim. During this writing, I use words whose meaning I know vaguely but don&#8217;t
know the exact usage, and in such cases, I usually open a new browser window and
look up the meaning of the word in an online dictionary. This process of looking
up the dictionary meaning was getting rather tedious, so I wrote a small Vim
plugin today to do this job with a simple command.</p>

<p><s>To use the plugin, first install
<a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a>. Then, get my
<a href="http://www.vim.org/scripts/script.php?script_id=2001">lookup.vim</a> script and
copy it to <code>~/.vim/plugin/</code>.</s>. See the <a href="http://www.vim.org/scripts/script.php?script_id=2001">new version&#8217;s installation instructions</a>, it now uses John Goerzen&#8217;s dict client implementation in Python.</p>

<p>Next time you use Vim, just place your cursor over any word and run <code>:Lookup</code>,
and you&#8217;ll see something like this:</p>

<div class="center">
<a href="http://www.flickr.com/photos/swaroop/1233236084/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1104/1233236084_56a1e0ec1a_m.jpg" width="236" height="240" alt="lookup.vim screenshot" /></a>
</div>


<p>Since, this is the only command starting with L on my Vim installation, I just
end up running <code>:L</code>. Of course, you can always create your own keyboard
shortcuts to make it easier.</p>

<p><strong>Update</strong>: Based on the comments, I&#8217;ve <a href="http://www.vim.org/scripts/script.php?script_id=2001">updated the script</a> to now use the DICT protocol and talks to some servers. This avoids screen-scraping, is much faster to use, allows me to now use both a dictionary and a thesaurus which is very very handy because I can see what other words I can use, and of course, doesn&#8217;t violate any TOS (which screen-scraping could amount to).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/lookup/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to use Vim with Firefox</title>
		<link>http://www.swaroopch.com/blog/how-to-use-vim-with-firefox/</link>
		<comments>http://www.swaroopch.com/blog/how-to-use-vim-with-firefox/#comments</comments>
		<pubDate>Wed, 26 Apr 2006 02:16:27 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.swaroopch.info/archives/2006/04/26/how-to-use-vim-with-firefox/</guid>
		<description><![CDATA[If you&#8217;re a Vim user like me, you would&#8217;ve wished many a time that you could use Vim to edit text in Firefox. Too bad, the Mozex extension doesn&#8217;t work anymore. Thanks to Samuel Wright, I have now discovered another way to achieve the same &#8211; using the ViewSourceWith extension. I have put up the [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a Vim user like me, you would&#8217;ve wished many a time that you could use Vim to edit text in Firefox. Too bad, the <a href="http://mozex.mozdev.org/">Mozex extension</a> doesn&#8217;t work anymore.</p>

<p>Thanks to Samuel Wright, I have now discovered another way to achieve the same &#8211; using the ViewSourceWith extension.</p>

<p><s>I have put up the set of steps on my wiki on how to <a href="http://swaroopch.info/text/How_to_use_Vim_with_Firefox">use Vim to edit text in Firefox</a>.</s>  The wiki page is no longer available. Please refer the <a href="http://apps.sourceforge.net/mediawiki/dafizilla/index.php?title=Vsw:faq#Vim">Official ViewSourceWith FAQ</a> instead.</p>

<p><em>Note</em> : This works only for plain text entries. It will <strong>not</strong> work for rich text formatting options such as GMail or Yahoo! Mail compose page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/how-to-use-vim-with-firefox/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>GVim</title>
		<link>http://www.swaroopch.com/blog/gvim/</link>
		<comments>http://www.swaroopch.com/blog/gvim/#comments</comments>
		<pubDate>Fri, 24 Mar 2006 18:24:10 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://www.swaroopch.info/archives/2006/03/25/gvim/</guid>
		<description><![CDATA[A message by Bram on vim-announce: The past few years many people have sponsored my work on Vim. Now version 7 is nearing completion, beta testing will start soon, very soon. A big thanks to all who supported me! I would not have been able to do this without your help. But things are going [...]]]></description>
			<content:encoded><![CDATA[<p>A message by <a href="http://groups.yahoo.com/group/vimannounce/message/152">Bram on vim-announce</a>:</p>

<blockquote><p>The past few years many people have sponsored my work on Vim.  Now
version 7 is nearing completion, beta testing will start soon, very
soon.  A big thanks to all who supported me!  I would not have been able
to do this without your help.</p>

<p>But things are going to change.  I have accepted a job offer and will go
back to a full time job in a few months.  To avoid speculation and
rumours: <u>I am going to work for Google in Zurich</u>.  Fortunately I can
spend part of my time on Vim.  But it will obviously be less than the
past few years when I was working 150% of my time on Vim.</p>

<p>I will no longer need sponsorship to survive.  Therefore, starting the
end of March, all money given for Vim sponsorship and registration will
go to the project in Kibaale, Uganda.  And no, this is not an April
fools joke.</p>

<p>The voting will continue as before.  And seeing people give money will
motivate me to keep working on Vim.  The children need the help much
more than me anyway.  Thus please keep sending money!</p></blockquote>

<p>P.S. Yes, I have <a href="http://www.vim.org/sponsor/">donated</a> to Vim before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/gvim/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Connect the text</title>
		<link>http://www.swaroopch.com/blog/connect-the-text/</link>
		<comments>http://www.swaroopch.com/blog/connect-the-text/#comments</comments>
		<pubDate>Mon, 09 May 2005 14:45:24 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.swaroopch.info/archives/2005/05/09/connect-the-text/</guid>
		<description><![CDATA[A while ago I was thinking about using a wiki to organize my notes, but I don&#8217;t know if even that scenario would be useful for quick note taking because of the conversion from wiki syntax to HTML everytime which causes a lag when saving the notes. I have found a simple and effective solution [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I was <a href="http://www.swaroopch.com/archives/2005/04/08/yahoo-notepad-as-wiki/">thinking about using a wiki</a> to organize my notes, but I don&#8217;t know if even that scenario would be useful for quick note taking because of the conversion from wiki syntax to HTML everytime which causes a lag when saving the notes.</p>

<p>I have found a simple and effective solution (next to paper and pen, which I would <strong>always</strong> prefer) by using <a href="http://www.vim.org">VIM</a> with the <a href="http://www.vim.org/scripts/script.php?script_id=293">Universal Text Linking plugin</a> and the <a href="http://www.vim.org/scripts/script.php?script_id=1242">Markdown syntax file</a>.</p>

<p>As the name indicates, the Universal Text Linking (or UTL for short) plugin allows you to create URLs that you can access like real hyperlinks (within VIM) and even opens a browser or media player depending on the type of file you link to.</p>

<p>I like using Markdown syntax because I find it to be the most cleanest and simplest of semantic text markup styles that I have used. So, the Markdown syntax highlighting makes the text even more pleasant to read.</p>

<p>Let me give an example on how I created a plain text wiki:</p>

<p>![13103132][Medium][]</p>

<p>I have one central file which acts like an index to the other
documents and this is the first file I always open. I also put in any
critically urgent, etc. stuff in this file, so I&#8217;m always reminded of it.</p>

<p>I have unimaginatively named this file as &#8216;plan&#8217; and here are the contents of that file:</p>

<blockquote><ul>
<li>[ProjectA]</li>
<li>[MeetOnSaturday]</li>
</ul>
</blockquote>

<p>From here, I just press <code>\gu</code> on <em>[ProjectA]</em> and it takes me to that
file. So, I read or make changes to the notes on my top-secret project and then I just hit <code>Ctrl-O</code> and I&#8217;m back to my &#8216;plan&#8217; file which I started with.</p>

<p>If you run <code>set filetype=mkd</code> for the file, you will get Markdown syntax highlighting. Better yet, just put a <a href="http://vimdoc.sourceforge.net/htmldoc/usr_21.html#21.6">modeline</a> such as <code># vim: filetype=mkd</code> as the last line of the file and VIM will automatically do this for you everytime.</p>

<p>In effect, you have a wiki using just plain text!</p>

<p>I think I must be catching the <a href="http://www.hacknot.info/hacknot/action/showEntry?eid=71">Wikiphilia</a>.</p>

<p><em>Sidebar</em>: I have <code>let mapleader=","</code> in my vimrc file, so I press <code>,gu</code> to open links. I find the comma easier to type than the backslash.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/connect-the-text/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Editing Away</title>
		<link>http://www.swaroopch.com/blog/editing-away/</link>
		<comments>http://www.swaroopch.com/blog/editing-away/#comments</comments>
		<pubDate>Sun, 14 Mar 2004 05:01:19 +0000</pubDate>
		<dc:creator>Swaroop</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://swaroop.textdriven.com/archives/2004/03/14/editing-away/</guid>
		<description><![CDATA[A text editor is one of the most important tools in the kit of every programmer. It is the starting point for us when we intend to write programs or anything else. It is therefore important to understand the strengths and weaknesses of our editor as well as being able to utilise the editor to [...]]]></description>
			<content:encoded><![CDATA[<p>

A text editor is one of the most important tools in the kit of every programmer. It is the starting point for us when we intend to write programs or anything else. It is therefore important to understand the strengths and weaknesses of our editor as well as being able to utilise the editor to its fullest potential. One such good editor is VIM. Bram Moolenaar, the creator of VIM, discusses the <a href="http://www.moolenaar.net/habits.html">Seven habits of effective text editing</a> and uses VIM as an example of showing how to do things.

</p>

]]></content:encoded>
			<wfw:commentRss>http://www.swaroopch.com/blog/editing-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 2/42 queries in 0.043 seconds using memcached
Object Caching 628/717 objects using memcached

Served from: www.swaroopch.com @ 2012-02-09 11:57:56 -->
