<?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>Idle Time &#187; vim</title>
	<atom:link href="http://boredzo.org/blog/archives/category/programming/toolchain/vim/feed" rel="self" type="application/rss+xml" />
	<link>http://boredzo.org/blog</link>
	<description>The personal weblog of Peter Hosey.</description>
	<lastBuildDate>Mon, 06 Sep 2010 15:41:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Quickie: Finding an svn conflict marker with vim</title>
		<link>http://boredzo.org/blog/archives/2008-02-12/quickie-finding-an-svn-conflict-marker-with-vim</link>
		<comments>http://boredzo.org/blog/archives/2008-02-12/quickie-finding-an-svn-conflict-marker-with-vim#comments</comments>
		<pubDate>Wed, 13 Feb 2008 03:38:10 +0000</pubDate>
		<dc:creator>Peter Hosey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Version control]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://boredzo.org/blog/archives/2008-02-12/quickie-finding-an-svn-conflict-marker-with-vim</guid>
		<description><![CDATA[/[]\{7\}
]]></description>
			<content:encoded><![CDATA[<p><kbd>/[<=>]\{7\}</kbd></p>
]]></content:encoded>
			<wfw:commentRss>http://boredzo.org/blog/archives/2008-02-12/quickie-finding-an-svn-conflict-marker-with-vim/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to quickly change several lines at once</title>
		<link>http://boredzo.org/blog/archives/2007-01-24/how-to-quickly-change-several-lines-at-once</link>
		<comments>http://boredzo.org/blog/archives/2007-01-24/how-to-quickly-change-several-lines-at-once#comments</comments>
		<pubDate>Wed, 24 Jan 2007 09:05:48 +0000</pubDate>
		<dc:creator>Peter Hosey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-01-24/how-to-quickly-change-several-lines-at-once</guid>
		<description><![CDATA[It's 130.87 K, and just over four seconds, and will play under any version of QuickTime.



It shows me using vim to replace an old variable name (“fullScreenOverlayWindow”) with a new one (“panel”). The sequence of events:


I move into position.
I enter Visual Block mode by pressing ctrl-v.
I jump to the end of the current word with [...]]]></description>
			<content:encoded><![CDATA[<p>It's 130.87 K, and just over four seconds, and will play under any version of QuickTime.</p>

<p class="screencast"><embed width="382" height="215" controller="true" autoplay="false" src="/stuph/vim-visualblock.mov" /></p>

<p>It shows me using <a href="http://vim.sourceforge.net/">vim</a> to replace an old variable name (“fullScreenOverlayWindow”) with a new one (“panel”). The sequence of events:</p>

<ol>
<li>I move into position.</li>
<li>I enter Visual Block mode by pressing <kbd>ctrl-v</kbd>.</li>
<li>I jump to the end of the current word with <kbd>e</kbd>.</li>
<li>I jump 7 lines down with <kbd>7j</kbd>. This gives me a total of 8 lines selected (including the one I started on).</li>
<li>I enter Change mode by pressing <kbd>c</kbd>.</li>
<li>I type my shiny new variable name. (Notice that it only displays on the line where my cursor is; all the others stay blank for the duration of my Change.)</li>
<li>I exit Change mode by pressing <kbd>escape</kbd>.</li>
<li>I wait a beat.</li>
<li>Voila!</li>
</ol>

<p>Cocoa text editors like TextEdit and Xcode have rectangular selection, but not rectangular editing; you will obliterate all the lines, but only insert your new text into the first line. This is not useful.</p>]]></content:encoded>
			<wfw:commentRss>http://boredzo.org/blog/archives/2007-01-24/how-to-quickly-change-several-lines-at-once/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>An insight into vi</title>
		<link>http://boredzo.org/blog/archives/2006-11-16/an-insight-into-vi</link>
		<comments>http://boredzo.org/blog/archives/2006-11-16/an-insight-into-vi#comments</comments>
		<pubDate>Thu, 16 Nov 2006 14:11:39 +0000</pubDate>
		<dc:creator>Peter Hosey</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolchain]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[Best Of]]></category>

		<guid isPermaLink="false">http://boredzo.org/blog/archives/2006-11-16/an-insight-into-vi</guid>
		<description><![CDATA[Here are three of vi's many commands:


$
Move to the last column in the line
%
Move to the opposite character in a pair (e.g. {→})
^
Move to the first non-whitespace column in the line


On a US keyboard, these three characters are contiguous: shift-4, -5, and -6, respectively.

This means that you can quickly navigate code like this with only [...]]]></description>
			<content:encoded><![CDATA[<p>Here are three of vi's many commands:</p>

<dl>
<dt>$</dt>
<dd>Move to the last column in the line</dd>
<dt>%</dt>
<dd>Move to the opposite character in a pair (e.g. {→})</dd>
<dt>^</dt>
<dd>Move to the first non-whitespace column in the line</dd>
</dl>

<p>On a US keyboard, these three characters are contiguous: shift-4, -5, and -6, respectively.</p>

<p>This means that you can quickly navigate code like this with only your ring, middle, and index fingers on one hand:</p>

<blockquote><p class="code">⁰if(foo) {¹
	doTheThingToTheThing();
²} else {³
	doTheThingToTheOtherThing();
⁴}</p></blockquote>

<ul>
<li>From 4 to 0: %^%^</li>
<li>From 0 to 4: $%$%</li>
</ul>

<p>Neat, huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://boredzo.org/blog/archives/2006-11-16/an-insight-into-vi/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A vim quickie</title>
		<link>http://boredzo.org/blog/archives/2006-07-22/vim-quickie</link>
		<comments>http://boredzo.org/blog/archives/2006-07-22/vim-quickie#comments</comments>
		<pubDate>Sat, 22 Jul 2006 11:04:00 +0000</pubDate>
		<dc:creator>Peter Hosey</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolchain]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://boredzo.org/blog/archives/2006-07-22/a-vim-quickie</guid>
		<description><![CDATA[:g/^[-+].\+{\s*$/,/^}/fold ←Folds all Obj-C methods in the current file.
 Technorati tags: vim
]]></description>
			<content:encoded><![CDATA[<p><kbd>:g/^[-+].\+{\s*$/,/^}/fold</kbd> ←Folds all Obj-C methods in the current file.</p>
<p><img width="16" height="16" alt="" src="http://www.technorati.com/favicon.ico" /> Technorati tags: <a href="http://technorati.com/tags/vim" rel="tag">vim</a></p>
]]></content:encoded>
			<wfw:commentRss>http://boredzo.org/blog/archives/2006-07-22/vim-quickie/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making vim grok Obj-C</title>
		<link>http://boredzo.org/blog/archives/2006-04-24/making-vim-grok-obj-c</link>
		<comments>http://boredzo.org/blog/archives/2006-04-24/making-vim-grok-obj-c#comments</comments>
		<pubDate>Mon, 24 Apr 2006 03:52:00 +0000</pubDate>
		<dc:creator>Peter Hosey</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolchain]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://boredzo.org/blog/archives/2006-04-24/making-vim-grok-obj-c</guid>
		<description><![CDATA[Like many, I use the popular open-source text editor vim. Earlier, I set about making it more usable through syntax coloring. This included tweaking its support for Objective-C.
First, mkdir ~/.vim, and cd ~/.vim. Now mkdir syntax. cp /usr/share/vim/vim62/filetype.vim . and cp /usr/share/vim/vim62/syntax/objc.vim syntax/. Then select and copy this patch:

Index: filetype.vim
===================================================================
--- filetype.vim 2005-03-21 02:12:47.000000000 -0800
+++ filetype.vim [...]]]></description>
			<content:encoded><![CDATA[<p>Like many, I use the popular open-source text editor <a href="http://vim.org/">vim</a>. Earlier, I set about making it more usable through syntax coloring. This included tweaking its support for Objective-C.</p>
<p>First, <kbd>mkdir ~/.vim</kbd>, and <kbd>cd ~/.vim</kbd>. Now <kbd>mkdir syntax</kbd>. <kbd>cp /usr/share/vim/vim62/filetype.vim .</kbd> and <kbd>cp /usr/share/vim/vim62/syntax/objc.vim syntax/</kbd>. Then select and copy this patch:</p>
<blockquote><p>
<pre>Index: filetype.vim
===================================================================
--- filetype.vim 2005-03-21 02:12:47.000000000 -0800
+++ filetype.vim 2006-04-24 03:33:27.000000000 -0700
@@ -262,7 +262,7 @@

 " .h files can be C or C++, set c_syntax_for_h if you want C
 au BufNewFile,BufRead *.h
- \ if exists("c_syntax_for_h") | setf c | else | setf cpp | endif
+ \ if exists("c_syntax_for_h") | setf c | else | if exists("objc_syntax_for_h") | setf objc | else | setf cpp | endif | endif

 " TLH files are C++ headers generated by Visual C++'s #import from typelibs
 au BufNewFile,BufRead *.tlh   setf cpp
Index: syntax/objc.vim
===================================================================
--- syntax/objc.vim 2005-03-21 02:12:49.000000000 -0800
+++ syntax/objc.vim 2006-04-24 03:19:25.000000000 -0700
@@ -43,6 +43,8 @@
 syn match  objcDirective "@class\|@end\|@defs"
 syn match  objcDirective "@encode\|@protocol\|@selector"

+syn keyword     objcStorageClass   in out inout byref bycopy
+
 " Match the ObjC method types
 "
 " NOTE: here I match only the indicators, this looks
@@ -73,6 +75,7 @@
   HiLink objcFactMethod Function
   HiLink objcStatement Statement
   HiLink objcDirective Statement
+  HiLink objcStorageClass StorageClass

   delcommand HiLink
 endif
</pre>
</p>
</blockquote>
<p>Now type <kbd>pbpaste | patch -p0</kbd>.</p>
<p>OK, now you have modified copies of the file type detector and the Obj-C syntax coloring. Now you need a .vimrc. If you already have one, add this to it; otherwise, create it with this:</p>
<blockquote><p>
<pre>let c_gnu=1
let c_no_bracket_error=1
let objc_syntax_for_h=1
syntax enable
</pre>
</p>
</blockquote>
<p>This makes the following changes:</p>
<dl>
<dt>c_gnu</dt>
<dd>Enables detection of some GCC extensions to C.</dd>
<dt>c_no_bracket_error</dt>
<dd>Allows <code>{}</code> inside of <code>[]</code>. This lets you do compound literals inside messages; for example: <code>[self setFrame:(NSRect){ NSZeroPoint, (NSSize){ 128.0f, 128.0f } }];</code></dd>
<dt>objc_syntax_for_h</dt>
<dd>Tells vim (with my modifications, that you did above) that a .h file is an Obj-C header, not a C++ header.</dd>
<dt>syntax enable</dt>
<dd>Enables syntax-highlighting.</dd>
</dl>
<p><img width="16" height="16" alt="" src="http://www.technorati.com/favicon.ico" /> Technorati tags: <a href="http://technorati.com/tags/vim" rel="tag">vim</a>, <a href="http://technorati.com/tags/Objective-C" rel="tag">Objective-C</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://boredzo.org/blog/archives/2006-04-24/making-vim-grok-obj-c/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.509 seconds -->
