<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-28654195</id><updated>2012-01-29T14:50:44.347-08:00</updated><category term='vimdiff'/><category term='broken terminal'/><category term='navigation'/><category term='tags'/><category term='droid sans mono monospace font'/><category term='keywordprg'/><category term='grep'/><category term='programming'/><category term='keyboard'/><category term='script'/><category term='link'/><category term='vim'/><category term='omg they try to turn vim into emacs'/><category term='vimrc'/><title type='text'>VI Improved Tips :: vimrc dissected</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default?start-index=101&amp;max-results=100'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>111</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-28654195.post-8540935788548734299</id><published>2012-01-29T14:34:00.000-08:00</published><updated>2012-01-29T14:50:44.354-08:00</updated><title type='text'>[off-topic] Perl on Windows: handling files with Unicode characters</title><content type='html'>Using &lt;a href="http://strawberryperl.com/"&gt;Strawberry Perl&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The rename with the proper Win32 module initialization:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;# init&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;use utf8;&lt;br /&gt;use Win32::OLE qw(in);&lt;br /&gt;Win32::OLE-&gt;Option( CP =&gt; Win32::OLE::CP_UTF8 );&lt;br /&gt;&lt;br /&gt;# the code&lt;br /&gt;my $fso = Win32::OLE-&gt;new("Scripting.FileSystemObject");&lt;br /&gt;$fso-&gt;MoveFile( ".\\".$old_name , ".\\".$new_name );&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Recursively scan directory tree:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;# the code&lt;br /&gt;sub scan1&lt;br /&gt;{&lt;br /&gt; my ($f, $l) = @_;&lt;br /&gt; my $obj = Win32::OLE-&gt;new('Scripting.FileSystemObject');&lt;br /&gt;&lt;br /&gt; my $folder = $obj-&gt;GetFolder( $f );&lt;br /&gt; die "ERROR: $f" unless $folder;&lt;br /&gt; foreach my $file (in $folder-&gt;Files) {&lt;br /&gt;  print $file-&gt;{Name}, ", size ", $file-&gt;{Size}, "bytes\n";&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; my $collection = $folder-&gt;{SubFolders};&lt;br /&gt; foreach my $value (in $collection) {&lt;br /&gt;  my $foldername = $value-&gt;{Name};&lt;br /&gt;  scan1( "$f\\$foldername", $l );&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;my @l;&lt;br /&gt;scan1( 'c:\\Movies', \@l );&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa711216%28v=vs.71%29.aspx"&gt;Scripting.FileSystemObject documentation&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8540935788548734299?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8540935788548734299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8540935788548734299' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8540935788548734299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8540935788548734299'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2012/01/off-topic-perl-on-windows-handling.html' title='[off-topic] Perl on Windows: handling files with Unicode characters'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6288277191458762077</id><published>2012-01-17T13:46:00.000-08:00</published><updated>2012-01-17T14:31:47.522-08:00</updated><title type='text'>A use case for \%#</title><content type='html'>Some time ago, per chance, quite obscure feature of VIM's regular expressions: &lt;code&gt;\%#&lt;/code&gt; - &lt;code&gt;:h /\%#&lt;/code&gt; says "Matches with the cursor position."&lt;br /&gt;&lt;br /&gt;At first I couldn't see any use for it.&lt;br /&gt;&lt;br /&gt;But then, while editing per hand some XMLs, I stumbled upon a problem: how to insert a tag break (close and open), while adding the indentation? Normal VIM macrii(*) can insert - but one looses the cursor position as soon as movement commands are used. But to make a copy of the indentation, one needs to move the cursor to the beginning of the line.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Edit0. OK. It just dawned on me. One could first insert the XML tag break + new line. Then copy indentation. Uh. Need to sleep more and more often. But I already wrote the post so what the heck I'll just post it. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Then I recalled that the regular expressions could match current cursor position. And I had a hunch that the &lt;code&gt;\%#&lt;/code&gt; could be used for the purpose. The Enlightenment come only few days later and took shape of &lt;i&gt;that&lt;/i&gt; for the &amp;lt;p&gt; tag:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:s!^\(\s*\)\(.\{}\)\s\+\(\k*\%#\k*\)!\1\2&amp;lt;/p&gt;\r\1&amp;lt;p&gt;\3!&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;First () submatch are the spaces (= indentation) of the current line.&lt;br /&gt;&lt;br /&gt;Second () submatch is everything up to the word under cursor (matched non-greedily as I had some fancy problems with greedy match here).&lt;br /&gt;&lt;br /&gt;Third () submatch is the actual word under cursor, anchored by the &lt;code&gt;\%#&lt;/code&gt; to the current cursor position. (The redundant spaces before the word are trimmed between the second and third submatches.)&lt;br /&gt;&lt;br /&gt;That all is replaced by. Original line: \1\2 is the line up to the word under cursor, closing &amp;lt;/p&gt; tag and \r for new line. New line: \1 which is the wanted indentation, opening &amp;lt;p&gt; tag and finally the word (obviously followed by the rest of the original line).&lt;br /&gt;&lt;br /&gt;P.S. &lt;code&gt;\S&lt;/code&gt; (anything but space) in place of &lt;code&gt;\k&lt;/code&gt; works pretty well too.&lt;br /&gt;&lt;br /&gt;P.P.S. VIM should support some sort of nesting of regular expressions. During editing lots of pieces could be reused - but only reuse regular expressions do support is the copy-paste. &lt;a href="http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators"&gt;The Clue.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(*) Because for the particular task at hand, macros have infested irreversibly my vimrc. Just like virii. Any press of a wrong button, and only the undo can sort out what the hell has just happened.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6288277191458762077?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6288277191458762077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6288277191458762077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6288277191458762077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6288277191458762077'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2012/01/use-case-for.html' title='A use case for \%#'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-5358792272090286173</id><published>2012-01-08T07:43:00.000-08:00</published><updated>2012-01-08T08:06:59.987-08:00</updated><title type='text'>[link] LOCALE settings and regexp classes</title><content type='html'>Spent some time editing a German text (actually an FB2 book) in VIM. Hell of a job, because as it turned out, &lt;a href="http://vim.1045645.n5.nabble.com/LOCALE-settings-and-regexp-classes-td3302557.html"&gt;I wasn't blind&lt;/a&gt;: VIM really doesn't support locale in the regular expressions.&lt;br /&gt;&lt;br /&gt;Workaround is to use \k (also suggested \i doesn't match ß). But that's only half workaround, since \k is case insensitive and case is used in German (e.g. nouns are capitalized).&lt;br /&gt;&lt;br /&gt;Another workaround is to use Perl or Python integration for regular expressions, since both provide locale support in the regular expressions. But I haven't gone that far yet.&lt;br /&gt;&lt;br /&gt;P.S. Here are some of my FB2 editing helper functions.&lt;br /&gt;&lt;br /&gt;&lt;font face="monospace"&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; some Fiction Book functions&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; merge adjacent paragraphs&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! ParaMany_ToSingle&lt;font color="#ffa500"&gt;()&lt;/font&gt;&amp;nbsp;range&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;lines&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:firstline&lt;/font&gt;,&amp;nbsp;&lt;font color="#40ffff"&gt;a:lastline&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;filter&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;lines,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'v:val !~ &amp;quot;^$&amp;quot;'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;xind&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;lines[&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;],&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\(\s*\).*'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\1'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;for&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;in&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;range&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;,&amp;nbsp;&lt;font color="#40ffff"&gt;len&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;lines&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;-&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;!=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;lines[i]&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;lines[i],&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\s*&amp;lt;p&amp;gt;[ \t]*'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo i.&amp;quot; &amp;lt; &amp;quot;.lines[i] | sleep 2&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;!=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;len&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;lines&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;-&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;lines[i]&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;lines[i],&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[ \t]*&amp;lt;/p&amp;gt;\s*$'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo i.&amp;quot; &amp;gt; &amp;quot;.lines[i] | sleep 2&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endfor&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo&amp;nbsp;&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;xxx:&amp;quot;&lt;/font&gt;&lt;font color="#80a0ff"&gt;.join( lines,&amp;nbsp;&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot; &amp;quot;&lt;/font&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;) | sleep 2&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;a:lastline&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;a:firstline&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;exec&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;':'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:firstline&lt;/font&gt;&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;,&amp;quot;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#40ffff"&gt;a:lastline&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;d&amp;quot;&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;text&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;join&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;lines,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot; &amp;quot;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;text&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;text,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[ \t]\{2,}'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;' '&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'g'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;text&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;text,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\s\+'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;setline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;a:firstline&lt;/font&gt;, xind&lt;font color="#ffff00"&gt;.&lt;/font&gt;text&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; gvim helper keyboard shortcuts (c-up/-down do not work in terminal)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! Keyboard_ParaCUpDown&lt;font color="#ffa500"&gt;()&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;map&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;C-Up&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;:-1,.call ParaMany_ToSingle()&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;CR&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;map&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;C-Down&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;:.,+1call ParaMany_ToSingle()&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;CR&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;Up&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&amp;nbsp;&amp;nbsp;insert section break, using the line's text as the section title&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! Para_ToSectionBreak&lt;font color="#ffa500"&gt;()&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;.&amp;quot;&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; capture the line indentation&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;xind&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\(\s*\).*'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\1'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; etch a bit from section tag indentation&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;xindS&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;xind,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\(\s*\)\s$'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\1'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; clean-up tags&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\v\&amp;lt;/{0,1}[a-z]+[^&amp;gt;]*\&amp;gt;'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'g'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[ \t]\+$'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^[ \t]\+'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; generate id, ensure starts with letter or _&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;id&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[^a-zA-Z0-9_-]'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'_'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'g'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;id&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;id,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\([^a-zA-Z_]\)'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'_\1'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'g'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;[xindS&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;/section&amp;gt;'&lt;/font&gt;,&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xindS&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;section&amp;gt;'&lt;/font&gt;,&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xind&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;title&amp;gt;'&lt;/font&gt;,&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xind&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;p id=&amp;quot;'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;id&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;quot;&amp;gt;'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffff00"&gt;t&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;/p&amp;gt;'&lt;/font&gt;,&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xind&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;/title&amp;gt;'&lt;/font&gt;&amp;nbsp;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;setline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;.&amp;quot;&lt;/font&gt;, l[&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;]&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&amp;nbsp;&lt;font color="#40ffff"&gt;append&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;.&amp;quot;&lt;/font&gt;, l[&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;:]&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;cursor&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;line&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;.&amp;quot;&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#40ffff"&gt;len&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l&lt;font color="#ffa500"&gt;)&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&amp;nbsp;&amp;nbsp;convert line's text to subtitle&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! Para_ToSubtitle&lt;font color="#ffa500"&gt;()&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;.&amp;quot;&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;xi&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\(\s*\).*'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\1'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\v\&amp;lt;/{0,1}[a-z]+[^&amp;gt;]*\&amp;gt;'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'g'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[ \t]\+$'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;t&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;t,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^[ \t]\+'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;setline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;.&amp;quot;&lt;/font&gt;, xi&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;subtitle&amp;gt;'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;t&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'&amp;lt;/subtitle&amp;gt;'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-5358792272090286173?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/5358792272090286173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=5358792272090286173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5358792272090286173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5358792272090286173'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2012/01/link-locale-settings-and-regexp-classes.html' title='[link] LOCALE settings and regexp classes'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7752130352157347785</id><published>2011-11-25T03:22:00.001-08:00</published><updated>2011-11-25T03:31:27.942-08:00</updated><title type='text'>[link] More Fun with Vimscript</title><content type='html'>&lt;a href="http://olex.openlogic.com/wazi/2011/more-fun-with-vimscript/"&gt;More Fun with Vimscript&lt;/a&gt; by Juliet Kemp.&lt;br /&gt;&lt;br /&gt;Mentions something totally new to me: ZOMG! VIM has a function debugger!!&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:h debug-scripts&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Example &lt;code&gt;:debug call CustomeFunc()&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;P.S. Wow, and profiler too! &lt;code&gt;:h profiling&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7752130352157347785?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7752130352157347785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7752130352157347785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7752130352157347785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7752130352157347785'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2011/11/link-more-fun-with-vimscript.html' title='[link] More Fun with Vimscript'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2275455097273739544</id><published>2011-02-20T14:21:00.000-08:00</published><updated>2011-02-20T14:31:27.565-08:00</updated><title type='text'>[link] Getting more out of Vim - some tips</title><content type='html'>&lt;a href="http://www.freesoftwaremagazine.com/columns/getting_more_out_vim_some_tips"&gt;Some VIM tips&lt;/a&gt; from &lt;a href="http://www.freesoftwaremagazine.com/"&gt;FSM&lt;/a&gt; (Free Software Magazine).&lt;br /&gt;&lt;br /&gt;The neat trick to count words - &lt;code&gt;:s/pattern//gn&lt;/code&gt; - somehow I have missed it before.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;^O&lt;/code&gt;/&lt;code&gt;^I&lt;/code&gt; (in normal mode, &lt;code&gt;:h jump-motions&lt;/code&gt;) are cool too. Work like Back/Forward buttons on the web browsers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2275455097273739544?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2275455097273739544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2275455097273739544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2275455097273739544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2275455097273739544'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2011/02/link-getting-more-out-of-vim-some-tips.html' title='[link] Getting more out of Vim - some tips'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7037872945874865677</id><published>2011-01-20T13:57:00.000-08:00</published><updated>2011-01-20T14:29:03.734-08:00</updated><title type='text'>modeline on steroids</title><content type='html'>&lt;a href="http://vimdoc.sourceforge.net/htmldoc/options.html#modeline"&gt;Modeline&lt;/a&gt; is a great tool. Yet, sometimes it is also quite limiting: it can change only limited number of options. My most often gripe - one can't change the 'makeprg' to add the target (for what in past I attempted to use &lt;a href="http://vimrc-dissection.blogspot.com/2008/09/defining-user-command-easy-make.html"&gt;the workaround&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Reading through the modeline documentation, I have found an idea how to &lt;i&gt;improve&lt;/i&gt; the modeline to allow to execute random VIM commands, not just setting few options.&lt;br /&gt;&lt;br /&gt;Here it goes.&lt;br /&gt;&lt;br /&gt;&lt;font face="monospace"&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! CustomModeLine&lt;font color="#ffa500"&gt;(&lt;/font&gt;cid&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&amp;amp;modelines&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;lln&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;line&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;$&amp;quot;&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;lln&amp;nbsp;|&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;lln&amp;nbsp;|&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;while&lt;/font&gt;&amp;nbsp;i&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;lln&lt;font color="#ffff00"&gt;-&lt;/font&gt;i&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;l&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;a:cid&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;exec&lt;/font&gt;&amp;nbsp;strpart&lt;font color="#ffa500"&gt;(&lt;/font&gt;l,&amp;nbsp;&lt;font color="#40ffff"&gt;stridx&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l,&amp;nbsp;&lt;font color="#40ffff"&gt;a:cid&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#40ffff"&gt;strlen&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:cid&lt;/font&gt;&lt;font color="#ffa500"&gt;))&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;i&lt;font color="#ffff00"&gt;-&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endwhile&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;au&lt;/font&gt;&amp;nbsp;&lt;font color="#60ff60"&gt;BufReadPost&lt;/font&gt;&amp;nbsp;*&amp;nbsp;:&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;span style="background-color: #000000"&gt;&lt;font color="#cccccc"&gt;CustomModeLine&lt;/font&gt;&lt;/span&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;VIM666:&amp;quot;&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;Now, after adding that to the .vimrc, one can put something like this in the last lines (among &lt;code&gt;&amp;modelines&lt;/code&gt; last of them) of the source file:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;// VIM666:set makeprg=make\ aaaa&lt;/code&gt;&lt;br /&gt;&lt;code&gt;// VIM666:sy keyword cType block_id_t&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;When opening the file in VIM, the scriptlet would find the lines and &lt;code&gt;:execute&lt;/code&gt; them. First would add to the makeprg a default target "aaaa", second would make symbol "block_id_t" to be highlighted as a C/C++ type (typedef from my pet not-really-a-project).&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Why the &lt;code&gt;VIM666:&lt;/code&gt;?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Well. VIM creator has allowed the modelines to change only limited set of options for the reason:&lt;br /&gt;&lt;br /&gt;&lt;i&gt; No other commands than "set" are supported, for security reasons (somebody&lt;br /&gt;might create a Trojan horse text file with modelines).  And not all options&lt;br /&gt;can be set.  For some options a flag is set, so that when it's used the&lt;br /&gt;|sandbox| is effective. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Thus, randomizing the "VIM666" into something more random and unpredictable is strongly advised. Sadly, &lt;code&gt;:sandbox&lt;/code&gt; isn't configurable and thus incapable of disallowing only certain actions - at the moment it is all-or-nothing type of command in VIM.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7037872945874865677?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7037872945874865677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7037872945874865677' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7037872945874865677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7037872945874865677'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2011/01/modeline-on-steroids.html' title='modeline on steroids'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2959912986673516909</id><published>2011-01-11T08:00:00.000-08:00</published><updated>2011-01-11T08:04:54.256-08:00</updated><title type='text'>[DUMP] VIM custom folding for Rational Purify's plog files</title><content type='html'>Dump.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; Fold (collapse) the Purify problem descriptions into single line&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; As the comment to the fold, Purify message would appear with&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; list of files/libraries in the call stack.&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&amp;nbsp;&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;-CHAIN_LENGTH=32&amp;quot;&lt;/font&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;parameter in PURIFYOPTIONS is highly recommended&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; custom fold function for Purify's .plog files&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! PuriFold&lt;font color="#ffa500"&gt;(&lt;/font&gt;lnum&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:lnum&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; fold starts at '&lt;/font&gt;&lt;span style="background-color: #ffff00"&gt;&lt;font color="#0000ff"&gt;XXX&lt;/font&gt;&lt;/span&gt;&lt;font color="#80a0ff"&gt;:' marker (though exclude File In Use)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;l&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^[A-Z][A-Z][A-Z]:'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;amp;&amp;amp;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;l&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;!~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^FIU:'&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; store fold level of previous line&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;pfl&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;foldlevel&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:lnum&lt;/font&gt;&lt;font color="#ffff00"&gt;-&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; check whether it is a continuation of a fold&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;pfl&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;amp;&amp;amp;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\t'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&amp;nbsp;l&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^&amp;nbsp;&amp;nbsp;\*'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&amp;nbsp;l&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;pfl&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'&amp;lt;1'&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#80a0ff"&gt;&amp;quot; close fold if open&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;else&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#80a0ff"&gt;&amp;quot; not a fold otherwise&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; custom fold text function to quickly see the approx location of the problem&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! Puri_GatherNames&lt;font color="#ffa500"&gt;(&lt;/font&gt;fl, ll&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:i&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;a:fl&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:&lt;font color="#ffff00"&gt;x&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:count&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;while&lt;/font&gt;&amp;nbsp;l:i&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;lt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;a:ll&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;amp;&amp;amp;&lt;/font&gt;&amp;nbsp;l:count&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;lt;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;10&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:&lt;font color="#ffff00"&gt;l&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;i&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;l:l&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\*unknown func\*'&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:&lt;font color="#ffff00"&gt;l&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;''&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;matchstr&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;l:l,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\[[^\]]\+\]$'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;strlen&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l:tmp&lt;font color="#ffa500"&gt;)&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:i&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;l:i&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;continue&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\[libclntsh\.so'&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[*ORA*]'&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\[libstlport\.so'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\[_\(pair\|tree\|alloc\|map\|construct\)\.h:'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=~&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^\[_\(tree\)\.c:'&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[*STL*]'&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;strlen&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l:tmp&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&amp;amp;&amp;amp;&lt;/font&gt;&amp;nbsp;l:tmp&lt;font color="#ffff00"&gt;!=&lt;/font&gt;&lt;font color="#40ffff"&gt;strpart&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l:x,&lt;font color="#40ffff"&gt;strlen&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l:x&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;-&lt;/font&gt;&lt;font color="#40ffff"&gt;strlen&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;l:tmp&lt;font color="#ffa500"&gt;))&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[crt1.o]'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[rtlib.o]'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[crti.o]'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[libCrun.a]'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[libc.so.1]'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[libnsl.so.1]'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;||&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffa500"&gt;\&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l:tmp&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[libsocket.so.1]'&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; nothing, ignore system libraries&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;else&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:&lt;font color="#ffff00"&gt;x&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;l:x&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;' '&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;l:tmp&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:count&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;l:count&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;echo x&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;l:i&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;l:i&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endwhile&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;l:x&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! Puri_FoldText&lt;font color="#ffa500"&gt;()&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;foldtext&lt;/font&gt;&lt;font color="#ffa500"&gt;()&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;span style="background-color: #000000"&gt;&lt;font color="#cccccc"&gt;Puri_GatherNames&lt;/font&gt;&lt;/span&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;v:foldstart, v:foldend&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; activate the folds when .plog file is opened&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;au&lt;/font&gt;&amp;nbsp;&lt;font color="#60ff60"&gt;BufReadPost&lt;/font&gt;&amp;nbsp;*.plog&amp;nbsp;&lt;font color="#ffff00"&gt;set&lt;/font&gt;&amp;nbsp;&lt;font color="#ff80ff"&gt;foldexpr&lt;/font&gt;=PuriFold(v&lt;font color="#ffff00"&gt;:&lt;/font&gt;lnum)&lt;br /&gt;&lt;font color="#ffff00"&gt;au&lt;/font&gt;&amp;nbsp;&lt;font color="#60ff60"&gt;BufReadPost&lt;/font&gt;&amp;nbsp;*.plog&amp;nbsp;&lt;font color="#ffff00"&gt;set&lt;/font&gt;&amp;nbsp;&lt;font color="#ff80ff"&gt;foldmethod&lt;/font&gt;=expr&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;quot; use custom fold text function&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;au&lt;/font&gt;&amp;nbsp;&lt;font color="#60ff60"&gt;BufReadPost&lt;/font&gt;&amp;nbsp;*.plog&amp;nbsp;&lt;font color="#ffff00"&gt;set&lt;/font&gt;&amp;nbsp;&lt;font color="#ff80ff"&gt;foldtext&lt;/font&gt;=Puri_FoldText()&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;P.S. &lt;a href="http://en.wikipedia.org/wiki/IBM_Rational_Purify"&gt;WT Rational Purify?&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2959912986673516909?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2959912986673516909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2959912986673516909' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2959912986673516909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2959912986673516909'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2011/01/dump-vim-custom-folding-for-rational.html' title='[DUMP] VIM custom folding for Rational Purify&apos;s plog files'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-5917250278720204619</id><published>2011-01-10T05:19:00.000-08:00</published><updated>2011-01-10T06:32:14.133-08:00</updated><title type='text'>VIM inline calculator revisited, floating point numbers comapatible</title><content type='html'>As it turned out, sometimes I really like to use &lt;a href="http://vimrc-dissection.blogspot.com/2010/05/vim-inline-calculator.html"&gt;the VIM as a calculator&lt;/a&gt;, with free editing, history and even access to env vars. (Unintentionally, calls to VIM functions also do work.)&lt;br /&gt;&lt;br /&gt;Yesterday I needed to calculate few more things than usually and also using floating point numbers. I have recalled that &lt;a href="http://vimdoc.sourceforge.net/htmldoc/version7.html#added-7.2"&gt;VIM 7.2 added support for &lt;code&gt;Float&lt;/code&gt; type&lt;/a&gt; and tried it out. After some tinkering, I managed to make my calculator even more useful to me than expected.&lt;br /&gt;&lt;br /&gt;The previous version of calculator looked &lt;i&gt;relatively&lt;/i&gt; innocent:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;:map &amp;lt;silent&amp;gt; &amp;lt;F11&amp;gt; :exec "s!^\\([^=]\\{-}\\)\\( *=.*\\)\\=$!\\1 = ".eval(substitute(getline(".")," *=.*$","",""))."!"&amp;lt;CR&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The new version looks more serious and even less intimidating:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! CalcGetValue&lt;font color="#ffa500"&gt;(&lt;/font&gt;tag&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;tag_marker&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;#&amp;quot;&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;s&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;search&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;'^'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#40ffff"&gt;a:tag&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;tag_marker,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;bn&amp;quot;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;s&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&amp;nbsp;|&amp;nbsp;&lt;font color="#ffff00"&gt;throw&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;Calc error: tag &amp;quot;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffff00"&gt;tag&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot; not found&amp;quot;&lt;/font&gt;&amp;nbsp;|&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; avoid substitute() as we are called from inside substitute()&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;line&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;s&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;idx&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;strridx&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;line,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;=&amp;quot;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;idx&amp;nbsp;&lt;font color="#ffff00"&gt;==&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;-&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;throw&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;Calc error: line with tag &amp;quot;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffff00"&gt;tag&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;&amp;quot;doesn't contain the '='&amp;quot;&lt;/font&gt;&amp;nbsp;|&amp;nbsp;&lt;font color="#ffff00"&gt;endif&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;strpart&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;line, idx&lt;font color="#ffff00"&gt;+&lt;/font&gt;&lt;font color="#ffa0a0"&gt;1&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt;! CalcLine&lt;font color="#ffa500"&gt;(&lt;/font&gt;ln&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;tag_marker&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;#&amp;quot;&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;s&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;getline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:ln&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; remove old result if any&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;x&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;s,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[[:space:]]*=.*'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;&amp;quot;&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; strip the tag, if any&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;x1&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;x,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'[a-zA-Z0-9]\+'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;tag_marker&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'[[:space:]]*'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;&amp;quot;&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; replace values by the tag&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;x1&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;substitute&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&amp;nbsp;x1, tag_marker&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'\([a-zA-Z0-9]\+\)'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'\=CalcGetValue(submatch(1))'&lt;/font&gt;,&amp;nbsp;&lt;font color="#ffa0a0"&gt;'g'&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; evaluate&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;v&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;0&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;try&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;v&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#40ffff"&gt;eval&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;x1&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;catch&lt;/font&gt;&amp;nbsp;/E806:/&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; VIM can't convert float to string automagically, apply printf(&amp;quot;%g&amp;quot;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;let&lt;/font&gt;&amp;nbsp;v&amp;nbsp;&lt;font color="#ffff00"&gt;=&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa0a0"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#40ffff"&gt;eval&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#ffa0a0"&gt;'printf( &amp;quot;%g&amp;quot;, '&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;x1&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;')'&lt;/font&gt;&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;endtry&lt;/font&gt;&lt;br /&gt;&lt;font color="#80a0ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot; finish the job&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;call&lt;/font&gt;&amp;nbsp;&lt;font color="#40ffff"&gt;setline&lt;/font&gt;&lt;font color="#ffa500"&gt;(&lt;/font&gt;&lt;font color="#40ffff"&gt;a:ln&lt;/font&gt;, x&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;' = '&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;v&lt;font color="#ffa500"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;:&lt;font color="#ffff00"&gt;map&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;silent&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;F11&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&amp;nbsp;:call CalcLine(&amp;quot;.&amp;quot;)&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;CR&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The new version addresses two my problems (old) allow simple reuse of the previous calculations and (new) allow floating point numbers.&lt;br /&gt;&lt;br /&gt;At the core, the usage of calculator remained pretty much the same as before. For example, typing &lt;code&gt;2*2&lt;/code&gt; and pressing F11 would change the line into &lt;code&gt;2*2 = 4&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;To allow reuse of previous calculation results, I have introduced the tags. A line with a calculation result can be prefixes with &lt;code&gt;label#&lt;/code&gt; tag (e.g. &lt;code&gt;label# 2*2 = 4&lt;/code&gt;). Results of the calculation can be accessed in another expression using &lt;code&gt;#label&lt;/code&gt;, e.g. &lt;code&gt;33*#label&lt;/code&gt;. During evaluation, the scriptlet above would search the buffer for string starting with &lt;code&gt;label#&lt;/code&gt; and put into the original expression whatever is found after the '=' on the matching line. (What has turned out to be a minor, nice-to-have feature: expression itself is optional; line &lt;code&gt;label# = value&lt;/code&gt; works as a definition of constant).&lt;br /&gt;&lt;br /&gt;Example: calculate area and volume given the radius. Type this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;radius# = 5&lt;/code&gt;&lt;br /&gt;&lt;code&gt;pi# = 3.1415&lt;/code&gt;&lt;br /&gt;&lt;code&gt;area#    pow(#radius,2)*#pi&lt;/code&gt;&lt;br /&gt;&lt;code&gt;volume#  pow(#radius,3)*#pi*4.0/3.0&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;First two lines work like constants denoting Pi and the radius. Press the F11 (or ^O + F11 if in insert mode) when cursor on 3rd and 4th lines to evaluate the expressions and see the results:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;area#    pow(#radius,2)*#pi = 78.5375&lt;/code&gt;&lt;br /&gt;&lt;code&gt;volume#  pow(#radius,3)*#pi*4.0/3.0 = 523.583333&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The new (to me) features that are used in the new calculator:&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://vimdoc.sourceforge.net/htmldoc/eval.html#search%28%29"&gt;search()&lt;/a&gt; to find a line number of a string matching given pattern (used to search in the buffer for the line with a tag).&lt;br /&gt;&lt;br /&gt;2. &lt;a href="http://vimdoc.sourceforge.net/htmldoc/eval.html#submatch%28%29"&gt;submatch()&lt;/a&gt;, when inside the substitution, to access a submatch (functional equivalent of &lt;code&gt;\1&lt;/code&gt;, &lt;code&gt;\2&lt;/code&gt; and so on).&lt;br /&gt;&lt;br /&gt;3. &lt;a href="http://vimdoc.sourceforge.net/htmldoc/change.html#sub-replace-expression"&gt;\=&lt;/a&gt; in &lt;code&gt;s///&lt;/code&gt; and &lt;a href="http://vimdoc.sourceforge.net/htmldoc/eval.html#substitute%28%29"&gt;substitute()&lt;/a&gt; to substitute with result of an expression instead of a constant.&lt;br /&gt;&lt;br /&gt;4. &lt;a href="http://vimdoc.sourceforge.net/htmldoc/eval.html#E806"&gt;E806&lt;/a&gt; + &lt;a href="http://vimdoc.sourceforge.net/htmldoc/eval.html#:try"&gt;:try&lt;/a&gt;. VIM can't convert float to string automatically. Error E806 is generated when that is attempted. Scriptlet catches the error and applies suggested by documentation conversion method - printf(). The construct with try/catch also ensures that integer calculation remains integer. Only if there are floating point numbers involved, exception would be thrown and the conversion would be performed (spares the redundant '.0' in the integer calculations).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-5917250278720204619?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/5917250278720204619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=5917250278720204619' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5917250278720204619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5917250278720204619'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2011/01/vim-inline-calculator-revisited.html' title='VIM inline calculator revisited, floating point numbers comapatible'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-768784614276253250</id><published>2010-12-16T09:13:00.000-08:00</published><updated>2010-12-22T14:44:36.155-08:00</updated><title type='text'>Make (next) found match to appear in the screen's center</title><content type='html'>Turned out to be easier than expected:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;nnoremap n nzz&lt;br /&gt;nnoremap N Nzz&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Simply adds the &lt;code&gt;zz&lt;/code&gt; (see &lt;code&gt;:h z.&lt;/code&gt;) to &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;N&lt;/code&gt; commands.&lt;br /&gt;&lt;br /&gt;P.S. &lt;a href="http://stackoverflow.com/questions/2372584?tab=votes#tab-top"&gt;Original&lt;/a&gt; question and answer as SO.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Edit1&lt;/b&gt; Problem with the solution is that the message &lt;code&gt;search hit BOTTOM, continuing at TOP&lt;/code&gt;, due to the &lt;code&gt;zz&lt;/code&gt; command, now doesn't appear on the screen anymore. Trying now to use the other tip: &lt;code&gt;set scrolloff=5&lt;/code&gt;. Will see how that works.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Edit2&lt;/b&gt; Yep, the &lt;code&gt;set scrolloff=5&lt;/code&gt; works for me much better than the &lt;code&gt;nzz&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-768784614276253250?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/768784614276253250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=768784614276253250' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/768784614276253250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/768784614276253250'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/12/make-next-found-match-to-appear-in.html' title='Make (next) found match to appear in the screen&apos;s center'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2901626421014677517</id><published>2010-10-19T02:17:00.000-07:00</published><updated>2010-10-19T02:30:04.702-07:00</updated><title type='text'>diff this!</title><content type='html'>&lt;a href="http://stackoverflow.com/questions/3619146/vimdiff-two-subroutines-in-same-file"&gt;Found a cool VIM's command&lt;/a&gt; - &lt;a href="http://vimdoc.sourceforge.net/htmldoc/diff.html#:diffthis"&gt;&lt;code&gt;:diffthis&lt;/code&gt;&lt;/a&gt;. Invoking it in two different buffers tells the editor to diff the buffers as if it was started as &lt;code&gt;vimdiff&lt;/code&gt;. Best (most interesting to me) part is that one can diff two unsaved buffers. E.g.:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;" split the screen vertically&lt;br /&gt;:vnew&lt;br /&gt;" paste first code fragment into the left buffer and&lt;br /&gt;:diffthis&lt;br /&gt;" press ^W^W to switch to the right buffer, paste the second code fragment and again call&lt;br /&gt;:diffthis&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To cancel the effect of &lt;code&gt;:diffthis&lt;/code&gt; one uses the &lt;code&gt;:diffoff&lt;/code&gt; command. The command is too buffer specific and has to be invoked in both buffers.&lt;br /&gt;&lt;br /&gt;Another interesting related command is &lt;code&gt;:diffpatch {diff-file}&lt;/code&gt; which again invokes &lt;code&gt;vimdiff&lt;/code&gt; diffing the file currently in buffer against the file with the patch applied.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2901626421014677517?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2901626421014677517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2901626421014677517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2901626421014677517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2901626421014677517'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/10/diff-this.html' title='diff this!'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8584092610903347318</id><published>2010-09-07T07:43:00.000-07:00</published><updated>2010-09-07T08:17:30.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><title type='text'>vim vs. grep : external quickfix/error file, cont'd</title><content type='html'>As an enhancement to my &lt;a href="http://vimrc-dissection.blogspot.com/2010/04/vim-vs-grep-external-quickfixerror-file.html"&gt;old trick of using grep with the VIM&lt;/a&gt;, I have finally come up with a solution which doesn't use the temp file:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ alias vq="vi -c ':cgetb' -c ':cfirst! ' -"&lt;br /&gt;$ grep -nr whatever . | grep -v garbage | vq&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The trick is to use the new VIM 7.x command &lt;code&gt;:cgetb&lt;/code&gt; which retrieves the error list from the current buffer. So first suck in the output of the &lt;code&gt;grep&lt;/code&gt; into the nameless buffer, tell VIM to use the buffer as a error list and then with &lt;code&gt;:cfirst!&lt;/code&gt; to jump to first matching line (and discard the nameless buffer).&lt;br /&gt;&lt;br /&gt;Note in alias the space after &lt;code&gt;:cfirst!&lt;/code&gt;: it is a &lt;i&gt;secret ingredient&lt;/i&gt; to avoid bash interpreting the ! as the history expansion mark.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8584092610903347318?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8584092610903347318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8584092610903347318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8584092610903347318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8584092610903347318'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/09/vim-vs-grep-external-quickfixerror-file.html' title='vim vs. grep : external quickfix/error file, cont&apos;d'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-1836904803141257109</id><published>2010-08-16T09:07:00.000-07:00</published><updated>2010-08-16T09:08:23.130-07:00</updated><title type='text'>Life goes on</title><content type='html'>&lt;a href="https://groups.google.com/group/vim_announce/browse_thread/thread/66c02efd1523554b?pli=1"&gt;VIM 7.3 released&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-1836904803141257109?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/1836904803141257109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=1836904803141257109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1836904803141257109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1836904803141257109'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/08/life-goes-on.html' title='Life goes on'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8959780326814665445</id><published>2010-08-04T12:28:00.000-07:00</published><updated>2010-08-04T12:51:29.925-07:00</updated><title type='text'>[off-topic] Rakudo - Perl6 - wait is over!</title><content type='html'>Just compiled the &lt;a href="http://rakudo.org/"&gt;Rakudo&lt;/a&gt; and it seems the wait for a &lt;a href="http://en.wikipedia.org/wiki/Perl_6"&gt;Perl6&lt;/a&gt; implementation is finally over!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;~/src/rakudo $ time ./perl6 -e 'print "hello\n"'&lt;br /&gt;hello&lt;br /&gt;&lt;br /&gt;real    0m3.052s&lt;br /&gt;user    0m0.708s&lt;br /&gt;sys     0m0.753s&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I mean, ~3 [*CENSORED*] seconds to print a puny [*CENSORED*] string?&lt;br /&gt;&lt;br /&gt;No folks, I'm not waiting for it anymore. I simply go on using the Perl5.&lt;br /&gt;&lt;br /&gt;R.I.P. Perl6, we barely knew you.&lt;br /&gt;&lt;br /&gt;P.S. I understand alpha/beta status and all. But I doubt that even release would be able to fix the 10-100x performance regression. And yes, I checked Parrot was all compiled with optimizations.&lt;br /&gt;&lt;br /&gt;P.P.S. I tested inside of the &lt;a href="http://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt;. That might slow down an application. Yet the Perl5 performance in the very same conditions is totally OK:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;~/src/rakudo $ time perl -e 'print "hello\n"'&lt;br /&gt;hello&lt;br /&gt;&lt;br /&gt;real    0m0.041s&lt;br /&gt;user    0m0.002s&lt;br /&gt;sys     0m0.013s&lt;br /&gt;~/src/rakudo $ &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;P.P.P.S. On my up-to-date &lt;a href="http://en.wikipedia.org/wiki/Sidux"&gt;Sidux&lt;/a&gt;, strace tells that "perl" needed only 101 syscall to print a string. Rakudo - 1146. Among them 527 &lt;a href="http://linux.die.net/man/2/brk"&gt;brk()&lt;/a&gt;s. That's a very RAM &lt;i&gt;conscious&lt;/i&gt; application we have here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8959780326814665445?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8959780326814665445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8959780326814665445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8959780326814665445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8959780326814665445'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/08/off-topic-rakudo-perl6-wait-is-over.html' title='[off-topic] Rakudo - Perl6 - wait is over!'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-859231891055009469</id><published>2010-06-19T17:48:00.001-07:00</published><updated>2010-06-20T08:56:06.209-07:00</updated><title type='text'>Getting the exit code from make in Vim</title><content type='html'>Just answered &lt;a href="http://stackoverflow.com/questions/3077513/getting-the-linux-error-code-from-make-in-vim"&gt;the question on SO&lt;/a&gt; and I think the final trick is worth documenting here. The problem is how to get after &lt;code&gt;:make&lt;/code&gt; exit code of the make itself. As it is wrapped by VIM, it gets lost in the pipe: &lt;code&gt;:echo v:shell_error&lt;/code&gt; always shows 0 (&lt;code&gt;:h v:shell_error&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;The bash-specific trick is:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:set shellpipe=2&gt;&amp;1\ \|\ tee\ %s;exit\ \${PIPESTATUS[0]}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The magic is in the &lt;code&gt;;exit ${PIPESTATUS[0]}&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;man bash&lt;/code&gt; (search for PIPESTATUS) and &lt;code&gt;:h 'shellpipe'&lt;/code&gt; (check the %s) for more info.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-859231891055009469?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/859231891055009469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=859231891055009469' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/859231891055009469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/859231891055009469'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/06/getting-exit-code-from-make-in-vim.html' title='Getting the exit code from make in Vim'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8781390279307966100</id><published>2010-06-07T08:17:00.000-07:00</published><updated>2010-06-07T08:19:20.589-07:00</updated><title type='text'>[link] VIM + ctags</title><content type='html'>&lt;a href="http://stackoverflow.com/questions/563616/vimctags-tips-and-tricks"&gt;Nothing new&lt;/a&gt;, yet useful to have for reference.&lt;br /&gt;&lt;br /&gt;So StackOverflow.com can be useful at times.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8781390279307966100?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8781390279307966100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8781390279307966100' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8781390279307966100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8781390279307966100'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/06/link-vim-ctags.html' title='[link] VIM + ctags'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-5025459038251354764</id><published>2010-05-07T06:13:00.000-07:00</published><updated>2010-05-19T07:23:46.195-07:00</updated><title type='text'>VIM inline calculator</title><content type='html'>Map the F11 key to VIM's eval() function (I hope the Blogger will not eat any characters):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:map &amp;lt;silent&amp;gt; &amp;lt;F11&amp;gt; :exec "s!^\\([^=]\\{-}\\)\\( *=.*\\)\\=$!\\1 = ".eval(substitute(getline(".")," *=.*$","",""))."!"&amp;lt;CR&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Came up during lengthy analysis of log files and source code. Some calculators allow expression. Some support history. But all that is quite limited and often is mouse driven. Check into the VIM's :help :let + digging around pointed in direction of the eval() and thus the monster macro was born.&lt;br /&gt;&lt;br /&gt;2 statements are at the core:&lt;br /&gt;&lt;br /&gt;1. &lt;code&gt;eval(substitute(getline(".")," *=.*$","",""))&lt;/code&gt; strip "= whatever" from the end of the string and feed it to eval(). &lt;code&gt;:h eval()&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;2. &lt;code&gt;:exec "s!!!"&lt;/code&gt; where we take everything from the line, save in \1 string before "=", replace the line with "\1 = " plus result of eval(). Requires &lt;code&gt;:set magic&lt;/code&gt;. Backslashes had to be doubled since &lt;code&gt;:exec&lt;/code&gt; looks for them.&lt;br /&gt;&lt;br /&gt;After adding that to vimrc or executing in place, open VIM, type on empty line "2*2", press Esc and F11. You should see "2*2 = 4".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Edit1&lt;/span&gt; Apparently, the eval() function isn't available in VIM 6.x. Equivalent using &lt;code&gt;:exec ":let"&lt;/code&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;function&lt;/font&gt; CalcX&lt;font color="#ffff00"&gt;(&lt;/font&gt;line_num&lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;br /&gt;        &lt;font color="#ffff00"&gt;let&lt;/font&gt; l &lt;font color="#ffff00"&gt;=&lt;/font&gt; &lt;font color="#00ffff"&gt;&lt;b&gt;getline&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;(&lt;/font&gt;a:line_num&lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;br /&gt;        &lt;font color="#ffff00"&gt;let&lt;/font&gt; expr &lt;font color="#ffff00"&gt;=&lt;/font&gt; &lt;font color="#00ffff"&gt;&lt;b&gt;substitute&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;(&lt;/font&gt; l, &lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot; *=.*$&amp;quot;&lt;/b&gt;&lt;/font&gt;,&lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot;&amp;quot;&lt;/b&gt;&lt;/font&gt;,&lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot;&amp;quot;&lt;/b&gt;&lt;/font&gt; &lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;br /&gt;        &lt;font color="#ffff00"&gt;exec&lt;/font&gt; &lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot;:let g:tmp_calcx = &amp;quot;&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;expr&lt;br /&gt;        &lt;font color="#ffff00"&gt;call&lt;/font&gt; &lt;font color="#00ffff"&gt;&lt;b&gt;setline&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;(&lt;/font&gt;a:line_num, expr&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot; = &amp;quot;&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;g:tmp_calcx&lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;:&lt;font color="#ffff00"&gt;map&lt;/font&gt; &lt;font color="#ffff00"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffff00"&gt;silent&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt; &lt;font color="#ffff00"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffff00"&gt;F11&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt; :&lt;font color="#ffff00"&gt;call&lt;/font&gt; &lt;font color="#ffffff"&gt;CalcX&lt;/font&gt;&lt;font color="#ffff00"&gt;(&lt;/font&gt;&lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot;.&amp;quot;&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffff00"&gt;CR&lt;/font&gt;&lt;font color="#ffff00"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Edit2&lt;/span&gt; VIM 7.2 supports floating point numbers. Would be interesting to experiment with it, but I haven't bothered to upgrade yet.&lt;br /&gt;&lt;br /&gt;Another little thing. &lt;code&gt;:echo&lt;/code&gt; too evaluates its parameters. Typing &lt;code&gt;:echo 2*2[Enter]&lt;/code&gt; would display 4.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-5025459038251354764?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/5025459038251354764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=5025459038251354764' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5025459038251354764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5025459038251354764'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/05/vim-inline-calculator.html' title='VIM inline calculator'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2187147028125693995</id><published>2010-05-03T09:50:00.001-07:00</published><updated>2011-05-30T03:58:51.875-07:00</updated><title type='text'>Disable syntax highlighting for a large file</title><content type='html'>Got to edit today a 150MB XML file. That was painful. Tried to disable the syntax highlighting - improved the performance a lot. So I added the trick to my vimrc:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;au BufReadPost * if getfsize(bufname("%")) &amp;gt; 512*1024 | &lt;br /&gt;\  set syntax= |&lt;br /&gt;\  endif&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That tells VIM to disable syntax (&lt;code&gt;:set syntax=&lt;/code&gt;) for any file whose size (while opening, &lt;code&gt;:h BufReadPost&lt;/code&gt;) is greater than a half meg (&lt;code&gt;if getfsize(bufname("%")) &amp;gt; 512*1024&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Edit1&lt;/b&gt; A more generic solution is to use the &lt;a href="http://vim.sourceforge.net/scripts/script.php?script_id=1506"&gt;LargeFile script from vim.sf.net&lt;/a&gt;, as found out by reader David in the comments below. Starting from version 5 (at the moment of writing available only on author's, Charles Campbell, &lt;a href="http://mysite.verizon.net/astronaut/vim/index.html#LARGEFILE"&gt;personal web page&lt;/a&gt;.), the script handles properly(*) the buffers with content populated using external commands. The script's main purpose in life is, when opening a large file, to set buffer options to make editing of large files more palatable experience: disable swap file, disable syntax highlighting, discard buffer with large file as soon as it is closed, disable folding, disable undo and so on.&lt;br /&gt;&lt;br /&gt;(*) Event used is the &lt;code&gt;BufReadPost&lt;/code&gt;, and the size of buffer is evaluated with &lt;code&gt;line2byte(line("$")+1)&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2187147028125693995?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2187147028125693995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2187147028125693995' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2187147028125693995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2187147028125693995'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/05/disable-syntax-highlighting-for-large.html' title='Disable syntax highlighting for a large file'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4981421728363182579</id><published>2010-05-03T09:00:00.000-07:00</published><updated>2010-05-03T09:02:01.090-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] Vim 7.2 Scripting</title><content type='html'>&lt;a href="http://www.packtpub.com/article/vim-7-2-scripting"&gt;Rundown on a number of simple things&lt;/a&gt; one encounters when starting scripting: version check, OS check, debugging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4981421728363182579?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4981421728363182579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4981421728363182579' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4981421728363182579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4981421728363182579'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/05/link-vim-72-scripting.html' title='[link] Vim 7.2 Scripting'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4054920287209847103</id><published>2010-04-29T07:17:00.000-07:00</published><updated>2010-04-29T07:40:29.901-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><title type='text'>vim vs. grep : external  quickfix/error file</title><content type='html'>My usual trick of using &lt;a href="http://vimrc-dissection.blogspot.com/2009/04/vim-grep-visual-grep.html"&gt;vim with grep&lt;/a&gt; works well when single grep invocation is sufficient.&lt;br /&gt;&lt;br /&gt;Yet quite often I end up piping one grep's output to another grep to refine the results. And that doesn't work with my old trick of wrapping the &lt;code&gt;grep MethodName *.cpp&lt;/code&gt; into &lt;code&gt;vim -c ":grep MethodName *.cpp"&lt;/code&gt; as the vim's internal grep doesn't support pipes.&lt;br /&gt;&lt;br /&gt;Digging through the documentation I found that it is possible to accomplish and it fits well to my workflow.&lt;br /&gt;&lt;br /&gt;Start grepping(*):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ grep MethodName *.cpp         # not fine enough...&lt;br /&gt;$ grep MethodName *.cpp | grep -v rubbish   # much better&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;# and save to a file&lt;br /&gt;$ grep -n MethodName *.cpp | grep -v rubbish &amp;gt; tmp1.out&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;N.B. -n to the grep is required as VIM needs line numbers to jump to the locations.&lt;br /&gt;&lt;br /&gt;And now tell VIM to use the produced &lt;code&gt;tmp1.out&lt;/code&gt; error file:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ vim -q tmp1.out&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$ vim -c ":cf tmp1.out"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;or from inside running VIM:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:cf tmp1.out&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Check the &lt;code&gt;:h :cf&lt;/code&gt; for the official documentation.&lt;br /&gt;&lt;br /&gt;(*) Obviously in the case it doesn't have to be grep - anything what produces similar output would do. I used once a perl script to generate VIM-compatible error file from diff output to preview potential merge conflicts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4054920287209847103?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4054920287209847103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4054920287209847103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4054920287209847103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4054920287209847103'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/04/vim-vs-grep-external-quickfixerror-file.html' title='vim vs. grep : external  quickfix/error file'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2840211396426123102</id><published>2010-04-16T04:52:00.000-07:00</published><updated>2010-04-16T05:05:46.585-07:00</updated><title type='text'>Capture output of a command</title><content type='html'>I was playing around with &lt;code&gt;^K&lt;/code&gt; and wanted to see all possible combinations available. &lt;code&gt;:help CTRL-K&lt;/code&gt; directed to the &lt;code&gt;:digraphs&lt;/code&gt; command. The problem is that amount of output from &lt;code&gt;:dig&lt;/code&gt; eclipses even that of the &lt;code&gt;:set all&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;So how one can somehow serialize the output into e.g. a VIM's buffer?&lt;br /&gt;&lt;br /&gt;Search on the net unveiled &lt;a href="http://vim.wikia.com/wiki/Capture_ex_command_output"&gt;the following tip&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:redir @a&lt;br /&gt;:dig&lt;br /&gt;:redir END&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Or even cooler, putting the output into a variable:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:redir =&gt; varname&lt;br /&gt;:dig&lt;br /&gt;:redir END&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;followed by &lt;code&gt;echo varname&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Final step is the dumping all that into a buffer/window: &lt;code&gt;:put =varname&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;P.S. The official &lt;a href="http://vim.wikia.com/wiki/Learn_to_use_help"&gt;Learn to use help&lt;/a&gt; article. Til now, I haven't knew that the &lt;code&gt;:help&lt;/code&gt; could be abbreviated to the &lt;code&gt;:h&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2840211396426123102?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2840211396426123102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2840211396426123102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2840211396426123102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2840211396426123102'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/04/capture-output-of-command.html' title='Capture output of a command'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7061328991547897805</id><published>2010-04-12T02:42:00.000-07:00</published><updated>2010-04-12T02:52:21.748-07:00</updated><title type='text'>Save file owned by root</title><content type='html'>Have just seen the nice trick on the Interwebs.&lt;br /&gt;&lt;br /&gt;It happens often: one starts editing a file owned by root. One gets used rather quickly to the VIM's warnings about editing a file one does not have permissions to. Only much later realizing that you can't save it.&lt;br /&gt;&lt;br /&gt;So you opened a VIM and edited a file, but can't save it. Instead of saving a temp one can use the trick:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:w !sudo tee %&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;P.S. ZOMG PONYZ!!1 For what I was always adding a custom shortcut &lt;code&gt;:map &amp;lt;F6&gt; :b#&amp;lt;CR&gt;&lt;/code&gt; turned out to have an official shortcut: ^6 (&lt;code&gt;:help CTRL-6&lt;/code&gt;). In VIM 7.1, this is sole shortcut of the form CTRL-&amp;lt;number&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7061328991547897805?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7061328991547897805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7061328991547897805' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7061328991547897805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7061328991547897805'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/04/save-file-owned-by-root.html' title='Save file owned by root'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4267509462849042099</id><published>2010-02-04T05:26:00.001-08:00</published><updated>2010-02-04T05:29:03.509-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='omg they try to turn vim into emacs'/><title type='text'>[link] Scripting the Vim editor, Part 3: Built-in lists</title><content type='html'>&lt;a href="http://www.ibm.com/developerworks/linux/library/l-vim-script-3/index.html?ca=dgr-lnxw97VMScript-P3dth-LX&amp;S_TACT=105AGX59&amp;S_CMP=grlnxw97"&gt; Scripting the Vim editor, Part 3: Built-in lists&lt;/a&gt;, part of &lt;a href="http://www.ibm.com/developerworks/views/linux/libraryview.jsp?end_no=100&amp;lcl_sort_order=asc&amp;type_by=Articles&amp;sort_order=desc&amp;show_all=false&amp;start_no=1&amp;sort_by=Title&amp;search_by=scripting+the+vim+editor&amp;topic_by=All+topics+and+related+products&amp;search_flag=true&amp;show_abstract=true"&gt;Scripting the vim editor&lt;/a&gt; series over at IBM's dW.&lt;br /&gt;&lt;br /&gt;Insightful read. Though I hope I would never need to script the VIM to such extent.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4267509462849042099?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4267509462849042099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4267509462849042099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4267509462849042099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4267509462849042099'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2010/02/link-scripting-vim-editor-part-3-built.html' title='[link] Scripting the Vim editor, Part 3: Built-in lists'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2661208126320311238</id><published>2009-12-13T03:43:00.000-08:00</published><updated>2009-12-13T03:48:45.377-08:00</updated><title type='text'>[link]   Vim 401: Extending Vim and More</title><content type='html'>While I was procrastinating here, the Joe Brockmeier guy is already on fourth installment of his articles dedicated to learning Vim: &lt;a href="http://www.linux.com/learn/tutorials/264315-vim-401-extending-vim-and-more"&gt;Vim 401: Extending Vim and More&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Do not forget to check the links (provided in article) to the previous installments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2661208126320311238?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2661208126320311238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2661208126320311238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2661208126320311238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2661208126320311238'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/12/link-vim-401-extending-vim-and-more.html' title='[link]   Vim 401: Extending Vim and More'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6405896271275031320</id><published>2009-11-26T05:10:00.000-08:00</published><updated>2009-11-26T05:10:19.055-08:00</updated><title type='text'>[link] Vim 101: A Beginner's Guide to Vim</title><content type='html'>&lt;a href="http://ldn.linuxfoundation.org/article/vim-101-a-beginners-guide-vim"&gt;Vim 101: A Beginner's Guide to Vim&lt;/a&gt; by &lt;a href="http://ldn.linuxfoundation.org/user/1887"&gt;Joe Brockmeier&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Bit too vi-ish IMO, yet as beginner's guide quite complete.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6405896271275031320?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://ldn.linuxfoundation.org/article/vim-101-a-beginners-guide-vim' title='[link] Vim 101: A Beginner&apos;s Guide to Vim'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6405896271275031320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6405896271275031320' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6405896271275031320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6405896271275031320'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/11/link-vim-101-beginners-guide-to-vim.html' title='[link] Vim 101: A Beginner&apos;s Guide to Vim'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8918285532113526425</id><published>2009-08-15T01:45:00.000-07:00</published><updated>2009-08-15T01:45:03.617-07:00</updated><title type='text'>[link] vi Introduction</title><content type='html'>&lt;a href="http://beginlinux.com/desktop_training/comm/shells/1347-vi-introduction"&gt;vi Introduction&lt;/a&gt;. Obviously by "vi" they mean "VIM".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8918285532113526425?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://beginlinux.com/desktop_training/comm/shells/1347-vi-introduction' title='[link] vi Introduction'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8918285532113526425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8918285532113526425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8918285532113526425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8918285532113526425'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/08/link-vi-introduction.html' title='[link] vi Introduction'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-3659993674202490709</id><published>2009-08-07T03:02:00.000-07:00</published><updated>2009-08-07T03:02:02.718-07:00</updated><title type='text'>[link] Vim Tutorial</title><content type='html'>&lt;a href="http://www.linuxconfig.org/Vim_Tutorial"&gt;Vim Tutorial&lt;/a&gt; - with videos!&lt;br /&gt;&lt;br /&gt;Bit too vi-compatible to my tastes. Otherwise most bases are covered.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-3659993674202490709?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.linuxconfig.org/Vim_Tutorial' title='[link] Vim Tutorial'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/3659993674202490709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=3659993674202490709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3659993674202490709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3659993674202490709'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/08/link-vim-tutorial.html' title='[link] Vim Tutorial'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6108677012823852637</id><published>2009-07-30T13:41:00.000-07:00</published><updated>2009-07-30T13:41:17.348-07:00</updated><title type='text'>[humor] Vim vs. Emacs</title><content type='html'>&lt;a href="http://en.tiraecol.net/modules/comic/comic.php?content_id=2&amp;amp;mode=flat&amp;amp;order=0"&gt;Vim vs. Emacs&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6108677012823852637?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://en.tiraecol.net/modules/comic/comic.php?content_id=2&amp;mode=flat&amp;order=0' title='[humor] Vim vs. Emacs'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6108677012823852637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6108677012823852637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6108677012823852637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6108677012823852637'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/07/humor-vim-vs-emacs.html' title='[humor] Vim vs. Emacs'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-14043923615709468</id><published>2009-07-17T15:14:00.000-07:00</published><updated>2009-07-17T15:14:49.170-07:00</updated><title type='text'>[link] Customizing vim and coloring the terminal in OpenSolaris 2009.06</title><content type='html'>&lt;a href="http://blog.hydrasystemsllc.com/2009/07/12/customizing-vim-and-coloring-the-terminal-in-opensolaris-200906/"&gt;dd if=/dev/random of=/dev/blog » Customizing vim and coloring the terminal in OpenSolaris 2009.06&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Hehehe. Somebody tries to make some use of Solaris.... Good Luck. Piece of advice though: upgrade to Linux, it's faster that way. Do not get me wrong... ... BUT WHAT THE F***?! This is year &lt;b&gt;2009&lt;/b&gt; and Solaris still can't take care of colors?&lt;br /&gt;&lt;br /&gt;P.S. BTW, Good Luck trying to use "TERM=xterm-color" though. Last I time I tried it on Solaris only to find that it is lacking something like half keyboard.&lt;br /&gt;&lt;br /&gt;Really. Get over it, swallow your childish pride and get the Linux. It works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-14043923615709468?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://blog.hydrasystemsllc.com/2009/07/12/customizing-vim-and-coloring-the-terminal-in-opensolaris-200906/' title='[link] Customizing vim and coloring the terminal in OpenSolaris 2009.06'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/14043923615709468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=14043923615709468' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/14043923615709468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/14043923615709468'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/07/link-customizing-vim-and-coloring.html' title='[link] Customizing vim and coloring the terminal in OpenSolaris 2009.06'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4528415449475473888</id><published>2009-07-06T04:49:00.000-07:00</published><updated>2009-07-06T04:49:12.656-07:00</updated><title type='text'>[link] Speed-Typing in Vim With Maps and Abbreviations - Better Than a Clipboard</title><content type='html'>&lt;a href="http://www.linuxplanet.com/linuxplanet/tips/6786/1/"&gt;LinuxPlanet - Tips - Speed-Typing in Vim With Maps and Abbreviations - Better Than a Clipboard&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Some nice tips on how to use VIM's abbreviations to insert some dynamic (not static!) text like e.g. current date.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4528415449475473888?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.linuxplanet.com/linuxplanet/tips/6786/1/' title='[link] Speed-Typing in Vim With Maps and Abbreviations - Better Than a Clipboard'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4528415449475473888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4528415449475473888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4528415449475473888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4528415449475473888'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/07/link-speed-typing-in-vim-with-maps-and.html' title='[link] Speed-Typing in Vim With Maps and Abbreviations - Better Than a Clipboard'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7660248653054599878</id><published>2009-06-27T07:02:00.000-07:00</published><updated>2009-06-27T07:02:43.143-07:00</updated><title type='text'>[link] LinuxPlanet - Tips - Turning on Unicode Support in Vim - Unicode in Vim</title><content type='html'>&lt;a href="http://www.linuxplanet.com/linuxplanet/tips/6779/1/"&gt;LinuxPlanet - Tips - Turning on Unicode Support in Vim - Unicode in Vim&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Though article is more about how to input all those fancy characters.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7660248653054599878?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.linuxplanet.com/linuxplanet/tips/6779/1/' title='[link] LinuxPlanet - Tips - Turning on Unicode Support in Vim - Unicode in Vim'/><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7660248653054599878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7660248653054599878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7660248653054599878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7660248653054599878'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/06/link-linuxplanet-tips-turning-on.html' title='[link] LinuxPlanet - Tips - Turning on Unicode Support in Vim - Unicode in Vim'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8004252097615162898</id><published>2009-06-05T04:10:00.000-07:00</published><updated>2009-06-05T04:24:32.674-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tags'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='vimrc'/><title type='text'>C++ vs. tags</title><content type='html'>One - at times very - annoying problem I had was that &lt;a href="http://vimrc-dissection.blogspot.com/2006/07/vim-tags-keyboard-shortcuts.html"&gt;jumping to tag&lt;/a&gt; not very C++ friendly. Namely it doesn't consider ':' (colon) to be part of word under cursor. It finally bothered me to the point of reading documentation which promptly sent me to &lt;code&gt;:help star&lt;/code&gt; where from I was sent to &lt;code&gt;:help 'iskeyword'&lt;/code&gt;. In less than a minute I had a fix:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;au BufReadPost *.cpp set isk+=:&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;'isk' is shorthand for 'iskeyword' and tells VIM what symbols should be considered to be part of (key)words. 'isk' is a list (as usually comma separated) of characters/character ranges and as with any other comma-separated lists, operators '+=' and '-=' do they job as they should.&lt;br /&gt;&lt;br /&gt;That obviously has an impact on any VIM command which works with words - '*', '#', 'w', etc. Beware.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8004252097615162898?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8004252097615162898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8004252097615162898' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8004252097615162898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8004252097615162898'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/06/c-vs-tags.html' title='C++ vs. tags'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-3602730506226856945</id><published>2009-05-19T07:27:00.000-07:00</published><updated>2009-05-19T07:31:33.050-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] Vim made easy: how to get your favorite IDE features in Vim</title><content type='html'>&lt;a href="http://arstechnica.com/open-source/guides/2009/05/vim-made-easy-how-to-get-your-favorite-ide-features-in-vim.ars"&gt;Vim made easy: how to get your favorite IDE features in Vim&lt;/a&gt; by &lt;a href=http://arstechnica.com/authors/ryan-paul/&gt;Ryan Paul&lt;/a&gt; on &lt;a href=http://arstechnica.com/open-source&gt;ArsTechnica&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Something about plug-ins and such. Lots of screenshots with Python source code, so I couldn't look deeper.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-3602730506226856945?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/3602730506226856945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=3602730506226856945' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3602730506226856945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3602730506226856945'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/05/link-vim-made-easy-how-to-get-your.html' title='[link] Vim made easy: how to get your favorite IDE features in Vim'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2846869603053933099</id><published>2009-04-26T05:54:00.000-07:00</published><updated>2009-04-26T06:02:05.623-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] my vi first steps</title><content type='html'>&lt;a href="http://www.handlewithlinux.com/"&gt;Handle With Linux&lt;/a&gt;'s &lt;a href="http://www.handlewithlinux.com/my-vi-first-steps"&gt;my vi first steps&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I presume the guy means "vim" as he's working with Linux and Linux for past 10+ years has "vi" as a symlink to vim.&lt;br /&gt;&lt;br /&gt;P.S. Nice trick to use :wn from a macro - to make macro to go to the next file. When macro invoked with repeat counter N, it would be applied to N first files open for editing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2846869603053933099?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2846869603053933099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2846869603053933099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2846869603053933099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2846869603053933099'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/04/link-my-vi-first-steps.html' title='[link] my vi first steps'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7925001510183497751</id><published>2009-04-25T07:57:00.000-07:00</published><updated>2009-04-25T08:02:38.709-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><title type='text'>vim + grep = visual grep</title><content type='html'>Trick I'm using quite often and is worth mentioning:&lt;br /&gt;&lt;br /&gt;&lt;code&gt; vi -c ":grep -r something files_or_dirs" &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That would start VIM and tell it to run grep right after that. Very convenient.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7925001510183497751?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7925001510183497751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7925001510183497751' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7925001510183497751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7925001510183497751'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/04/vim-grep-visual-grep.html' title='vim + grep = visual grep'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6701027171331258952</id><published>2009-04-09T03:24:00.000-07:00</published><updated>2009-04-09T03:27:05.766-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vimdiff'/><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] vimdiff - Edit two or Three versions of a file with Vim and show differences</title><content type='html'>&lt;a href="http://www.debianadmin.com/vimdiff-edit-two-or-three-versions-of-a-file-with-vim-and-show-differences.html"&gt;vimdiff intro&lt;/a&gt; on &lt;a href="http://www.debianadmin.com/"&gt;www.debianadmin.com&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6701027171331258952?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6701027171331258952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6701027171331258952' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6701027171331258952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6701027171331258952'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/04/link-vimdiff-edit-two-or-three-versions.html' title='[link] vimdiff - Edit two or Three versions of a file with Vim and show differences'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2803687628879310826</id><published>2009-02-11T14:57:00.001-08:00</published><updated>2009-06-17T05:53:09.792-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='keyboard'/><category scheme='http://www.blogger.com/atom/ns#' term='navigation'/><title type='text'>Fixing PageUp and PageDown</title><content type='html'>For a long time it had annoyed me that pressing PageUp or PageDown would not only go to previous/next screen portion of file, but would also screw cursor position. Essentially, unlike good ol' DOS editors, in VIM pressing PageDown followed by PageUp (or vice versa) would send cursor to the start of first visible line - not back to the position where it was before. Especially as I now work more on my notebook's cramped keyboard (which btw has full sized keyboard, yet no keypad and no dedicated PageUp/PageDown keys) hitting by accident any of the keys requires some seconds to recover cursor position.&lt;br /&gt;&lt;br /&gt;It annoyed me to the point of trying to make a VIM script to PageUp/PageDown properly.&lt;br /&gt;&lt;br /&gt;But thankfully I have sobered up and my always questioning mind aksed: "Do you idiot think that you are the first annoyed by that? Don't you think VIM folks already have a feature for that??"&lt;br /&gt;&lt;br /&gt;So finally I read as resourceful as ever :help - and my &lt;a href="http://en.wikipedia.org/wiki/Eureka_%28word%29"&gt;Eureka!&lt;/a&gt; awaited me right there, few lines above ":help &amp;lt;PageUp&amp;gt;". Now my ~/.vimrc has this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;map &amp;lt;PageUp&amp;gt; &amp;lt;C-U&amp;gt;&lt;br /&gt;map &amp;lt;PageDown&amp;gt; &amp;lt;C-D&amp;gt;&lt;br /&gt;imap &amp;lt;PageUp&amp;gt; &amp;lt;C-O&amp;gt;&amp;lt;C-U&amp;gt;&lt;br /&gt;imap &amp;lt;PageDown&amp;gt; &amp;lt;C-O&amp;gt;&amp;lt;C-D&amp;gt;&lt;br /&gt;set nostartofline&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Essentially, PageUp and PageDown are now mapped to ^U and ^D respectively. The difference is that ^U/^D do preserve cursor's relative line number (relative to first visible line). ^U/^D work in normal mode, thus the &lt;a href="http://vimrc-dissection.blogspot.com/2008/05/normal-command-from-insert-mode.html"&gt;^O trick&lt;/a&gt; is needed to access it from insert mode.&lt;br /&gt;&lt;br /&gt;The final nail - ":set nostartofline" - tells VIM during motion commands to try to preserve column where cursor is positioned.&lt;br /&gt;&lt;br /&gt;You cannot possibly imagine how happy I am ;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update1&lt;/b&gt;. I felt something was wrong - but couldn't tell it immediately. Apparently, unlike PageUp/PageDown, ^U/^D move cursor only by half of screen. In other words, to emulate PageUp/PageDown, they have to be triggered twice:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;map &amp;lt;PageUp&amp;gt; &amp;lt;C-U&amp;gt;&amp;lt;C-U&amp;gt;&lt;br /&gt;map &amp;lt;PageDown&amp;gt; &amp;lt;C-D&amp;gt;&amp;lt;C-D&amp;gt;&lt;br /&gt;imap &amp;lt;PageUp&amp;gt; &amp;lt;C-O&amp;gt;&amp;lt;C-U&amp;gt;&amp;lt;C-O&amp;gt;&amp;lt;C-U&amp;gt;&lt;br /&gt;imap &amp;lt;PageDown&amp;gt; &amp;lt;C-O&amp;gt;&amp;lt;C-D&amp;gt;&amp;lt;C-O&amp;gt;&amp;lt;C-D&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now that's much better.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update2&lt;/b&gt;. Here goes improved version:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;map &amp;lt;silent&amp;gt; &amp;lt;PageUp&amp;gt; 1000&amp;lt;C-U&amp;gt;&lt;br /&gt;map &amp;lt;silent&amp;gt; &amp;lt;PageDown&amp;gt; 1000&amp;lt;C-D&amp;gt;&lt;br /&gt;imap &amp;lt;silent&amp;gt; &amp;lt;PageUp&amp;gt; &amp;lt;C-O&amp;gt;1000&amp;lt;C-U&amp;gt;&lt;br /&gt;imap &amp;lt;silent&amp;gt; &amp;lt;PageDown&amp;gt; &amp;lt;C-O&amp;gt;1000&amp;lt;C-D&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;It turned out, ^U and ^D look at the counter for how many lines to scroll. Yet, they would scroll up to screen size. Thus specifying large value would make the shortcuts to scroll full screen at once. And you have to use counter all the time. Read more in &lt;code&gt;:help CTRL-U&lt;/code&gt; and &lt;code&gt;:help scroll&lt;/code&gt;. I'm not sure what led to the messy design (try &lt;code&gt;:set scroll=NN&lt;/code&gt;) yet the mappings as above work fine.&lt;br /&gt;&lt;br /&gt;With version from "Update1" especially on large files when triggering e.g. ^U^U it would be still visible that the scrolling happens in half screen steps. With the version that doesn't happen anymore as VIM now is properly told how many lines to scroll. As there is now counter involved, adding silent option is required.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2803687628879310826?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2803687628879310826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2803687628879310826' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2803687628879310826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2803687628879310826'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/02/fixing-pageup-and-pagedown.html' title='Fixing PageUp and PageDown'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6973947687267521789</id><published>2009-02-11T14:20:00.000-08:00</published><updated>2009-02-11T14:38:40.996-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='keywordprg'/><title type='text'>VIM's keywordprg for Perl and ... VIM itself</title><content type='html'>This is logical follow-up to my previous &lt;a href="http://vimrc-dissection.blogspot.com/2007/06/vim-man-pages-invokation-shortcut.html"&gt;post about K shortcut&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The two (actually three lines) added to ~/.vimrc allow when editing Perl and VIM scripts to transparently call with K &lt;i&gt;proper&lt;/i&gt; help system.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;au BufReadPost *.pl   set keywordprg=perldoc\ -f&lt;br /&gt;au BufReadPost *.vim  map K :exe ":help ".expand("&amp;lt;cword&amp;gt;")&amp;lt;CR&amp;gt;&lt;br /&gt;au BufReadPost .vimrc map K :exe ":help ".expand("&amp;lt;cword&amp;gt;")&amp;lt;CR&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Perl one is obvious. VIM one actually required some trickery: we do not call external program, but call VIM's internal command instead.&lt;br /&gt;&lt;br /&gt;P.S. BTW, &lt;code&gt;:help :help&lt;/code&gt; is pretty useful reading. Due to my error, 'K' in VIM mode used to constantly show it, instead of expected 'expand("&amp;lt;cword&amp;gt;")'.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6973947687267521789?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6973947687267521789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6973947687267521789' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6973947687267521789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6973947687267521789'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2009/02/vims-keywordprg-for-perl-and-vim-itself.html' title='VIM&apos;s keywordprg for Perl and ... VIM itself'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-3562841488932492957</id><published>2008-11-20T04:53:00.000-08:00</published><updated>2008-11-20T05:08:56.164-08:00</updated><title type='text'>how to not loose vim stdin buffer after opening a file</title><content type='html'>I often use VIM instead of "less" as pager. Usually in a way like "diff -u ... | vim -R -c 'set syntax=diff' -" (for what I actually have a shell alias).&lt;br /&gt;&lt;br /&gt;The one thing was annoying me for quite some time: when vim reads input from stdin, it does create unnamed buffer where to the content is loaded. Unnamed means that as soon as I open in the same vim another file, the stdin input is lost and I do not know of a way to recover it: it doesn't show up in ":ls" anymore.&lt;br /&gt;&lt;br /&gt;I have tried to do ":w" yet that created a new file - but the buffer with stdin still remained unnamed and was still replaced by first open file.&lt;br /&gt;&lt;br /&gt;After some search I have found a nice command - ":sav" (:help :saveas).&lt;br /&gt;&lt;br /&gt;Unlike originally intended for ranges ":w" command, the ":sav" operates on files and thus has enough &lt;i&gt;authority&lt;/i&gt; to change buffer name, making stdin buffer persistent.&lt;br /&gt;&lt;br /&gt;P.S. "vim -" is described under ":help read-stdin" and ":help --" (two minuses). Though the description is quite shallow.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-3562841488932492957?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/3562841488932492957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=3562841488932492957' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3562841488932492957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3562841488932492957'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/11/how-to-not-loose-vim-stdin-buffer-after.html' title='how to not loose vim stdin buffer after opening a file'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6079458777487316183</id><published>2008-11-10T02:59:00.000-08:00</published><updated>2008-11-10T03:10:51.130-08:00</updated><title type='text'>getting colder?</title><content type='html'>Another gem (from pov of those of us who grep a lot) found in VIM documentation:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:help :colder&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;At first I thought that is another wit command but then realized that the name fits to &lt;code&gt;:cnext&lt;/code&gt; and &lt;code&gt;:cprev&lt;/code&gt; commands.&lt;br /&gt;&lt;br /&gt;Snip from VIM documentation:&lt;br /&gt;&lt;br /&gt;&lt;i&gt; So far has been assumed that there is only one list of errors.  Actually the&lt;br /&gt;ten last used lists are remembered.  When starting a new list, the previous&lt;br /&gt;ones are automatically kept. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;And the two commands are &lt;code&gt;:colder&lt;/code&gt; (to go to previous results) and &lt;code&gt;:cnewer&lt;/code&gt; (to go back to newer results).&lt;br /&gt;&lt;br /&gt;P.S. "List of errors" is used in VIM originally for &lt;code&gt;:make&lt;/code&gt;. Results of &lt;code&gt;:grep&lt;/code&gt; are also interpreted as list of errors, what promotes grep into rank of compiler (:&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6079458777487316183?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6079458777487316183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6079458777487316183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6079458777487316183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6079458777487316183'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/11/getting-colder.html' title='getting colder?'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2207906620683767244</id><published>2008-11-06T16:14:00.000-08:00</published><updated>2009-02-12T14:38:42.551-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>VIM tips exchange on Slashdot</title><content type='html'>&lt;a href="http://ask.slashdot.org/article.pl?sid=08/11/06/206213"&gt;Link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Flamewars Alert. This is &lt;a href="http://slashdot.org"&gt;Slashdot&lt;/a&gt; after all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2207906620683767244?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2207906620683767244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2207906620683767244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2207906620683767244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2207906620683767244'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/11/vim-tips-exchange-on-slashdot.html' title='VIM tips exchange on Slashdot'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8375673644416628940</id><published>2008-10-03T06:23:00.001-07:00</published><updated>2009-02-12T14:43:38.841-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>[link] vim scripts</title><content type='html'>From Sander Marechal: &lt;a href="http://www.jejik.com/articles/2008/10/my_list_of_must-have_vim_scripts/"&gt;My list of must-have vim scripts&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8375673644416628940?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8375673644416628940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8375673644416628940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8375673644416628940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8375673644416628940'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/10/link-vim-scripts.html' title='[link] vim scripts'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6660677886170524884</id><published>2008-09-14T10:10:00.000-07:00</published><updated>2008-09-14T10:32:11.990-07:00</updated><title type='text'>Defining a user command: easy make invocation</title><content type='html'>This little thing:&lt;br /&gt;&lt;br /&gt;&lt;font color="#ffff00"&gt;command&lt;/font&gt;&amp;nbsp;MM&amp;nbsp;:exec&amp;nbsp;&lt;font color="#ff40ff"&gt;&lt;b&gt;&amp;quot;:make &amp;quot;&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#00ffff"&gt;&lt;b&gt;substitute&lt;/b&gt;&lt;/font&gt;( &lt;font color="#00ffff"&gt;&lt;b&gt;substitute&lt;/b&gt;&lt;/font&gt;(&lt;font color="#00ffff"&gt;&lt;b&gt;expand&lt;/b&gt;&lt;/font&gt;(&lt;font color="#ff40ff"&gt;&lt;b&gt;'%:p'&lt;/b&gt;&lt;/font&gt;), &lt;font color="#ff40ff"&gt;&lt;b&gt;'\.[^\.]*$'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;''&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;''&lt;/b&gt;&lt;/font&gt;), &lt;font color="#ff40ff"&gt;&lt;b&gt;'^'&lt;/b&gt;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#00ffff"&gt;&lt;b&gt;getcwd&lt;/b&gt;&lt;/font&gt;()&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ff40ff"&gt;&lt;b&gt;'/'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;''&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;''&lt;/b&gt;&lt;/font&gt;)&lt;br /&gt;&lt;br /&gt;defines a new VIM command ":MM" which does invoke ":make" with name of current file without extension. E.g. if you edit file "helloworld.c" and then type command ":MM" that would expand to command ":make helloworld"&lt;br /&gt;&lt;br /&gt;Just in case I have also added stripping of $PWD (getcwd() in VIM universe) so that if you edit file from another directory, make would be called with relative path and Makefile from current directory would be used. That will not improve much make behavior, but if by chance you are using "cons", then that would work very well.&lt;br /&gt;&lt;br /&gt;Edit1. Forgot to mention. VIM mandates that all user commands start with capital letter (all standard commands start with lower case letters). That's why I named the custom command "MM"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6660677886170524884?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6660677886170524884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6660677886170524884' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6660677886170524884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6660677886170524884'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/09/defining-user-command-easy-make.html' title='Defining a user command: easy make invocation'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-349047825207521371</id><published>2008-08-26T05:32:00.000-07:00</published><updated>2009-02-12T14:42:45.317-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] 21 of the Best Free Linux Text Editors</title><content type='html'>&lt;a href="http://www.linuxlinks.com/article/20080824052425167/Editors.html"&gt; 21 of the Best Free Linux Text Editors &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, VI and Emacs clones are not presented. Emacs itself is too bloated to be used by people who like to remain in control of their text editor - but there are number of decent Emacs clones.&lt;br /&gt;&lt;br /&gt;From Wikipedia: &lt;a href="http://en.wikipedia.org/wiki/Emacs#Other_modern_forks_and_clones"&gt;Emacs clones&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Vi#Derivatives_and_clones"&gt;VI clones&lt;/a&gt;. VIM is listed in VI clones.&lt;br /&gt;&lt;br /&gt;P.S. Most important Emacs shortcuts: Ctrl-g - end minibuffer editing, if any; Ctrl-x Ctrl-c - exit Emacs. Ctrl-g you need because often, after entering shortcut from another text editor, you might end-up in Emacs minibuffer (internal command line). Ctrl-x Ctrl-c will not work in minibuffer - so you need to press Ctrl-g. After exiting Emacs, type in shell "vim" and press Enter to start real text editor ^_^&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-349047825207521371?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/349047825207521371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=349047825207521371' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/349047825207521371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/349047825207521371'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/08/link-21-of-best-free-linux-text-editors.html' title='[link] 21 of the Best Free Linux Text Editors'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7973436540204387908</id><published>2008-08-25T08:46:00.000-07:00</published><updated>2009-02-12T14:39:07.370-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] 100 Vim commands</title><content type='html'>&lt;a href="http://www.catswhocode.com/blog/web-development/100-vim-commands-every-programmer-should-know-11"&gt;100 Vim commands every programmer should know&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Nice summary of vim commands.&lt;br /&gt;&lt;br /&gt;P.S. Though apparently the people are messing up "vim" and "vi". As things stand right now, "vim" has absolutely nothing to do with "vi". Hey I worked in "vi" (on both Solaris 10 and HP-UX 11.x) - that was most frustrating 5 minutes in my life. The *NIX vendors do not even bother adding keyboard support. Solaris' "vi" proudly says that it wasn't updated since 1996.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7973436540204387908?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7973436540204387908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7973436540204387908' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7973436540204387908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7973436540204387908'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/08/link-100-vim-commands.html' title='[link] 100 Vim commands'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6481846168073434256</id><published>2008-07-09T07:02:00.000-07:00</published><updated>2008-09-14T10:33:10.901-07:00</updated><title type='text'>little useful bit of info showcmd</title><content type='html'>How to see how long selection (visual) is?&lt;br /&gt;&lt;br /&gt;How to see whether you have accidentally entered any numbers which would act as repeat counter for the command?&lt;br /&gt;&lt;br /&gt;The little thing I always forget about:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:set showcmd&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In right bottom corner (before ruler) little useful bits about actual state of keyboard input in normal are displayed.&lt;br /&gt;&lt;br /&gt;Most useful is of course to now how long visual selection is, which I use often to e.g. count number of characters.&lt;br /&gt;&lt;br /&gt;P.S. Documentation says the showcmd setting will be changed if you changed compatible mode. Shouldn't be a problem since no sane person uses compatible mode anyway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6481846168073434256?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6481846168073434256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6481846168073434256' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6481846168073434256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6481846168073434256'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/07/little-useful-bit-of-info-showcmd.html' title='little useful bit of info showcmd'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8722331334910383425</id><published>2008-05-29T23:43:00.000-07:00</published><updated>2008-05-29T23:44:18.854-07:00</updated><title type='text'>[off topic] Darn good quote</title><content type='html'>It's so much easier to suggest solutions when you don't know too much about the problem.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Malcolm Forbes&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8722331334910383425?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8722331334910383425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8722331334910383425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8722331334910383425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8722331334910383425'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/05/off-topic-darn-good-quote.html' title='[off topic] Darn good quote'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6029775051128494400</id><published>2008-05-29T14:07:00.000-07:00</published><updated>2008-05-29T14:08:48.488-07:00</updated><title type='text'>[link] Sweeten your Vim with Cream</title><content type='html'>Simple &lt;a href="http://www.linux-mag.com/id/6045"&gt;Vim intro&lt;/a&gt; by Linux Magazine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6029775051128494400?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6029775051128494400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6029775051128494400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6029775051128494400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6029775051128494400'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/05/link-sweeten-your-vim-with-cream.html' title='[link] Sweeten your Vim with Cream'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-3995897033095745480</id><published>2008-05-26T12:56:00.000-07:00</published><updated>2008-05-26T13:08:33.592-07:00</updated><title type='text'>My personal minimal .vimrc</title><content type='html'>Another upgrade, another OS, another update... Well, new home directory - consequently new &lt;code&gt;.vimrc&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Here is N hours into coding minimalistic usable &lt;code&gt;.vimrc&lt;/code&gt;:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;filetype plugin off&lt;br /&gt;syntax on&lt;br /&gt;imap &amp;lt;Insert&gt; &amp;lt;Nop&gt;&lt;br /&gt;set bs=2 ruler title comments= nowrap&lt;br /&gt;set cindent cinkeys-=: cinkeys-=0#&lt;br /&gt;colo torte&lt;br /&gt;let loaded_matchparen = 1&lt;br /&gt;au BufReadPost * if line("'\"") &gt; 0 &amp;&amp;&lt;br /&gt;   \  line("'\"") &lt;= line("$") | exe "normal g'\"" | endif&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I hope this time, Blogger/BlogSpot hadn't eaten any characters.&lt;br /&gt;The &lt;code&gt;set comment=&lt;/code&gt; creeped in before I have realized that &lt;code&gt;filetype plugin&lt;/code&gt; is still &lt;code&gt;on&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-3995897033095745480?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/3995897033095745480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=3995897033095745480' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3995897033095745480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3995897033095745480'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/05/my-personal-minimal-vimrc.html' title='My personal minimal .vimrc'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-1980656614875470754</id><published>2008-05-24T15:00:00.000-07:00</published><updated>2008-05-24T15:06:18.404-07:00</updated><title type='text'>Normal command from Insert mode</title><content type='html'>Always forget the very useful shortcut which is apparently intended for "Vim Easy":&lt;br /&gt;&lt;br /&gt;&lt;code&gt;^O&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;When in insert mode (and, by definition, in easy vim you are always in the mode) to insert command from Normal mode, you press first ^O and then start typing the command.&lt;br /&gt;&lt;br /&gt;e.g. to delete to the end of line press &lt;code&gt;^O&lt;/code&gt; followed by &lt;code&gt;Shift-d&lt;/code&gt;. Pressing &lt;code&gt;:&lt;/code&gt; you can also access all the ex commands too - but that will leave insert mode.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-1980656614875470754?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/1980656614875470754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=1980656614875470754' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1980656614875470754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1980656614875470754'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/05/normal-command-from-insert-mode.html' title='Normal command from Insert mode'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-3385329012514363182</id><published>2008-03-30T04:40:00.000-07:00</published><updated>2010-07-12T03:39:50.079-07:00</updated><title type='text'>Inserting command output from a function</title><content type='html'>&lt;span style="font-style:italic;"&gt;How would I use a vim function to insert the output of these commands at the current cursor position?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Well, that would look like a crude hack, yet here it goes:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;:&lt;font color="#ffff00"&gt;function&lt;/font&gt; &lt;span style="background-color: #000000"&gt;&lt;font color="#cccccc"&gt;InsertCmd&lt;/font&gt;&lt;/span&gt;&lt;font color="#ffff00"&gt;(&lt;/font&gt; cmd &lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;br /&gt;:       &lt;font color="#ffff00"&gt;exe&lt;/font&gt; &lt;font color="#ffa0a0"&gt;':silent !'&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;a:cmd&lt;font color="#ffff00"&gt;.&lt;/font&gt;&lt;font color="#ffa0a0"&gt;' &amp;gt; /tmp/vim.insert.xxx 2&amp;gt;/dev/null'&lt;/font&gt;&lt;br /&gt;:       &lt;font color="#ffff00"&gt;let&lt;/font&gt; l &lt;font color="#ffff00"&gt;=&lt;/font&gt; &lt;font color="#40ffff"&gt;readfile&lt;/font&gt;&lt;font color="#ffff00"&gt;(&lt;/font&gt; &lt;font color="#ffa0a0"&gt;'/tmp/vim.insert.xxx'&lt;/font&gt;, &lt;font color="#ffa0a0"&gt;''&lt;/font&gt;, &lt;font color="#ffa0a0"&gt;1&lt;/font&gt; &lt;font color="#ffff00"&gt;)&lt;/font&gt;&lt;br /&gt;:       &lt;font color="#ffff00"&gt;exe&lt;/font&gt; &lt;font color="#ffa0a0"&gt;&amp;quot;normal a&amp;quot;&lt;/font&gt;&lt;font color="#ffff00"&gt;.&lt;/font&gt;l[0]&lt;br /&gt;:       &lt;font color="#ffff00"&gt;redraw&lt;/font&gt;!&lt;br /&gt;:&lt;font color="#ffff00"&gt;endfunction&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;:&lt;font color="#ffff00"&gt;imap&lt;/font&gt; &lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;silent&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt; &lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;F5&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt; &lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;Esc&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;:call InsertCmd( 'hostname' )&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;CR&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;Insert&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;:&lt;font color="#ffff00"&gt;map&lt;/font&gt; &lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;silent&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt; &lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;F5&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt; :call InsertCmd( 'hostname' )&lt;font color="#ffa500"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#ffa500"&gt;CR&lt;/font&gt;&lt;font color="#ffa500"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The function InsertCmd(cmd) runs in shell given command and redirects its stdout to a file. Then using readfile() function, first line of file is read into list l. Finally using :normal command and a (:help a) command we put the first line of output into buffer.&lt;br /&gt;&lt;br /&gt;The two mappings for F5 key - for insert and for command mode show how to invoke the function to insert output of "hostname" into current cursor position. ":imap" probably needs extra &amp;lt;Right&amp;gt; on the end since due to switch between insert/normal modes cursor goes one position back.&lt;br /&gt;&lt;br /&gt;Edit1. &lt;a href="http://stackoverflow.com/questions/3208405/how-do-i-write-a-vim-function-to-output-the-result-of-a-system-command"&gt;Better way to do it, from SO&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-3385329012514363182?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/3385329012514363182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=3385329012514363182' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3385329012514363182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3385329012514363182'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2008/03/inserting-command-output-from-function.html' title='Inserting command output from a function'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6171798476543284886</id><published>2007-11-16T12:43:00.001-08:00</published><updated>2007-11-16T12:45:54.200-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='droid sans mono monospace font'/><title type='text'>[off topic] Another monospace font: Droid Sans Mono</title><content type='html'>Accidentally came across new (at least to me) monospace font called "Droid Sans Mono."&lt;br /&gt;&lt;br /&gt;Since I'm droid coder already, there is no real danger of using the font - with such terribly sounding name.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://damieng.com/blog/2007/11/14/droid-sans-mono-great-coding-font"&gt;Link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6171798476543284886?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6171798476543284886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6171798476543284886' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6171798476543284886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6171798476543284886'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/11/off-topic-another-monospace-font-droid.html' title='[off topic] Another monospace font: Droid Sans Mono'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6156820734182284057</id><published>2007-11-04T12:12:00.000-08:00</published><updated>2009-02-12T14:39:17.427-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] A more informative status line for Vim</title><content type='html'>&lt;a href="http://www.linux.com/feature/120126"&gt;A more informative status line for Vim&lt;/a&gt; by &lt;a href="http://www.linux.com/"&gt;Linux.com&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6156820734182284057?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6156820734182284057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6156820734182284057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6156820734182284057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6156820734182284057'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/11/link-more-informative-status-line-for.html' title='[link] A more informative status line for Vim'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8910593088800368977</id><published>2007-10-30T10:29:00.000-07:00</published><updated>2007-10-31T15:17:55.671-07:00</updated><title type='text'>[off topic] MSWindows - Minimize Window shortcut</title><content type='html'>Lack of shortcut to minimize current window had bothered me for very very long time.&lt;br /&gt;&lt;br /&gt;But finally I found a solution. There is a wonderful program for M$Windows called &lt;a href="http://www.autohotkey.net/"&gt;AutoHotkey&lt;/a&gt;. Main purpose of program is to allow you to override particular shortcuts to perform custom action. Program is pretty cryptic, but allow for some automation of Windows what is definitely progress. (For example I have bunch of shortcuts to retrieve information from Firefox in half-automatic fashion.)&lt;br /&gt;&lt;br /&gt;Now the magic to put into AutoHotkey.ahk (default) configuration file:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#x::&lt;br /&gt;WinMinimize, A&lt;br /&gt;return&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;"#x" is "Win-X" shortcut (hold the (otherwise worthless) key with Windows flag on it and press X). "WinMinimize, A" command tells to minimize active ("A") window. "return" tells to stop further script processing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Edit1.&lt;/span&gt;&lt;br /&gt;Bit of additional magic to disable the single-Alt menu silliness and to emulate Mac OS X input of German umlaut characters:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Alt::&lt;br /&gt;return&lt;br /&gt;&lt;br /&gt;&gt;!u::Send {ASC 0252}&lt;br /&gt;&gt;!o::Send {ASC 0246}&lt;br /&gt;&gt;!a::Send {ASC 0228}&lt;br /&gt;+&gt;!u::Send {ASC 0220}&lt;br /&gt;+&gt;!o::Send {ASC 0214}&lt;br /&gt;+&gt;!a::Send {ASC 0196}&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8910593088800368977?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8910593088800368977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8910593088800368977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8910593088800368977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8910593088800368977'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/10/off-topic-mswindows-minimize-window.html' title='[off topic] MSWindows - Minimize Window shortcut'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2382278591119810813</id><published>2007-10-29T14:36:00.000-07:00</published><updated>2007-10-29T14:40:59.231-07:00</updated><title type='text'>[off topic] VIM Plug-in for Eclipse</title><content type='html'>While wonders of KDE's VIM components are not new, that stroke me as ... funny.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vimplugin.sourceforge.net/"&gt;Vimplugin&lt;/a&gt; and &lt;a href="http://satokar.com/viplugin/"&gt;viPlugin&lt;/a&gt; allow one to use VIM editor as replacement of standard text editor of &lt;a href="http://www.eclipse.org/"&gt;Eclipse SDK&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Funny.&lt;br /&gt;&lt;br /&gt;P.S. Thanks God I'm safe from Java programming. For now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2382278591119810813?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2382278591119810813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2382278591119810813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2382278591119810813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2382278591119810813'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/10/off-topic-vim-plug-in-for-eclipse.html' title='[off topic] VIM Plug-in for Eclipse'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2949823092419449005</id><published>2007-08-13T07:36:00.000-07:00</published><updated>2007-09-19T04:44:02.258-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='broken terminal'/><title type='text'>VIM vs. broken OSs/terminals :: colors are forever!</title><content type='html'>The tip was found in VIM's help under &lt;code&gt;:help color-xterm&lt;/code&gt; and works for HP-UX and Solaris. I conditionally exclude Linux to be unaffected by workaround, since F/LOSS folks - compared to the Unix &lt;a href="http://www.groovygoon.com/cartoon.jpg"&gt;old&lt;/a&gt; &lt;a href="http://www.new1.com/jkohl/images/Mr%20Old%20Fart_350.jpg"&gt;farts&lt;/a&gt; - have managed somehow to ship decent terminfo/termcap boasting color support out of box.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;if &amp;t_Co &gt; 0&lt;br /&gt;       " Linux/etc has proper terminfo&lt;br /&gt;else&lt;br /&gt;       if &amp;term =~ "xterm"&lt;br /&gt;               if has("terminfo")&lt;br /&gt;                       set t_Co=8&lt;br /&gt;                       set t_Sf=^[[3%p1%dm&lt;br /&gt;                       set t_Sb=^[[4%p1%dm&lt;br /&gt;               else&lt;br /&gt;                       set t_Co=8&lt;br /&gt;                       set t_Sf=^[[3%dm&lt;br /&gt;                       set t_Sb=^[[4%dm&lt;br /&gt;               endif&lt;br /&gt;       endif&lt;br /&gt;endif&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The thing needs to be put into &lt;code&gt;~/.vimrc&lt;/code&gt;. The '^[' needs to be replaced by real escape character - ^V&amp;lt;Esc&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2949823092419449005?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2949823092419449005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2949823092419449005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2949823092419449005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2949823092419449005'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/08/vim-vs-broken-ossterminals-colors-are.html' title='VIM vs. broken OSs/terminals :: colors are forever!'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7477846334167581883</id><published>2007-08-12T02:01:00.000-07:00</published><updated>2007-08-12T02:05:19.971-07:00</updated><title type='text'>[off-topic] Hardcore vs. Casual gaming</title><content type='html'>In reply to one comment on Joystiq while &lt;a href="http://www.joystiq.com/2007/08/11/japanese-hardware-sales-jul-30-aug-5/2"&gt;discussing hardware sales&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&gt; I'd really like for somebody to define "hardcore game" for me.&lt;br /&gt;&lt;br /&gt;My definition of "hardcore game" is game which requires involved playing.&lt;br /&gt;&lt;br /&gt;I would consider you to be hardcore gamer in "Madden and NCAA football games". Because you have extensive experience in football games, you would demand more of it from newer games. That's what makes gaming "hardcore": entry level is very high.&lt;br /&gt;&lt;br /&gt;Casual gaming is all about "Pick and Play" e.g. WiiSports' Tennis or Baseball. One doesn't need to spend hours getting into game - s/he can pick WaggleMote and start playing right away.&lt;br /&gt;&lt;br /&gt;Also, feat of many console games I consider "hardcore" is boss fights and poor/non-existent saving system. "Pick and Play" should really be "Pick, Play and Put it back". And that's where most console games fail miserably: you can't stop playing moment you want to stop playing - but the moment game allows you to stop playing. E.g. Metroid and it stupid save rooms: you came into room and door was locked behind you - now you are expected to spend time looking for way out or fight boss. But you can NOT save game and start doing something else. No. Game doesn't allow that.&lt;br /&gt;&lt;br /&gt;Hardcore gaming: gaming demanding higher degree of involvement. Whether by mean of poor save system or by lots of tricks you need to keep in your head to be able to play game (and you easily start forgetting them if you do not play many hours daily; lengthy key combos are good example of that).&lt;br /&gt;&lt;br /&gt;Casual gaming: gaming by formula "Pick, Play and Move on." You can start any moment you want to play. You can play and enjoy game as long you want and have time. And last (but not least) you can stop playing (preserving your progress) any moment you like or have to (the "have to"s are what adult life is all about).&lt;br /&gt;&lt;br /&gt;P.S. Many PC games are much better suited for casual gaming, since most of them have good save system (or what console folks call "instant save/load"). And somehow PC games also manage to avoid the silliness of boss fights, which can bar you from making any progress in game for long time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7477846334167581883?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7477846334167581883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7477846334167581883' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7477846334167581883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7477846334167581883'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/08/off-topic-hardcore-vs-casual-gaming.html' title='[off-topic] Hardcore vs. Casual gaming'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4835851594459948598</id><published>2007-06-25T00:41:00.000-07:00</published><updated>2007-06-25T01:41:57.200-07:00</updated><title type='text'>VIM :: man pages invokation shortcut</title><content type='html'>I have finally found it. The very important shortcut I was missing long time. I knew it was there - but never actually managed to dig it up.&lt;br /&gt;&lt;br /&gt;K&lt;br /&gt;&lt;br /&gt;That's simple. It replaces my now archaic ":!man ".expand("&amp;lt;cword&amp;gt;") - use word under cursor and invoke 'K'eyword program on it. Keyword program is normally man. Can be configured with option 'keywordprg' (&lt;code&gt;:help 'keywordprg'&lt;/code&gt; for more info).&lt;br /&gt;&lt;br /&gt;If keywordprg is man, then VIM provides another cool feature: repeat count when used with K now tells to go to particular man section. e.g. 3K would invoke "man 3" on current word. What is very very cool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4835851594459948598?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4835851594459948598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4835851594459948598' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4835851594459948598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4835851594459948598'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/06/vim-man-pages-invokation-shortcut.html' title='VIM :: man pages invokation shortcut'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2639504923881575834</id><published>2007-06-06T14:46:00.000-07:00</published><updated>2007-06-06T14:50:50.716-07:00</updated><title type='text'>[off topic] Tribute to Your-Mom</title><content type='html'>&lt;a href="http://your-mom-fansubs.blogspot.com/"&gt;Domou arigatou gozaimashita!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://your-mom-fansubs.blogspot.com/2007/05/lucky-channel-paraody.html"&gt;&lt;img src="http://img49.imageshack.us/img49/7383/nightfalconasakiraanihq6.gif"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2639504923881575834?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2639504923881575834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2639504923881575834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2639504923881575834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2639504923881575834'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/06/off-topic-tribute-to-your-mom.html' title='[off topic] Tribute to Your-Mom'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7801939437109985233</id><published>2007-05-29T07:25:00.001-07:00</published><updated>2007-09-19T05:06:55.172-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='broken terminal'/><title type='text'>Moving around in VIM : buggy terminal edition</title><content type='html'>Buggy terminals are one of the most frustrating things one can encounter when trying to edit a file on remote site.&lt;br /&gt;&lt;br /&gt;Big boys like Emacs are out of question immediately, since they depend on &amp;lt;Esc&gt; sequences too much. And the sequences are what is used to represent functional, arrow and motion keys in Unix world. Often even Backspace and Delete fall victims of buggy terminals.&lt;br /&gt;&lt;br /&gt;Though unpractical, it is often required to edit at least single file on remote site - to tell it proper terminal configuration - before anything else might be done.&lt;br /&gt;&lt;br /&gt;VIM is for rescue. VIM (ans as its ancestor VI) were designed in times when there were no such keys available at all. It might be painful to work that way, yet quick edit is quite OK.&lt;br /&gt;&lt;br /&gt;All the command are to be used in normal (non-insert) mode. Some of them as noted change vim's mode. To go back to normal mode, press Ctrl-[ or Esc.&lt;br /&gt;&lt;br /&gt;&lt;style type="text/css"&gt;.nobr br { display: none } td { vertical-align: top } .table-br tr td br { display: inline } &lt;/style&gt; &lt;div class="nobr"&gt;&lt;br /&gt;&lt;table border=1 class="table-br"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; u &lt;/td&gt;&lt;td&gt; Most important command here: undo. &lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; / &lt;/td&gt;&lt;td&gt; Search forward - the most effective way to move around in vim.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; ? &lt;/td&gt;&lt;td&gt; Search backward.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; :NNN&amp;lt;Enter&gt; &lt;/td&gt;&lt;br /&gt;&lt;td&gt; Go to line number NNN.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; x&lt;br /&gt;&lt;/td&gt;&lt;td&gt; Pressing 'x' would delete character under cursor. With repetition counter, can delete more than single character in a go: e.g. '20x' would delete 20 characters starting with current one (and analogous to pressing 'x' twenty times).&lt;br /&gt;&lt;p&gt; Backspace key (delete backward) is 'hx'. Delete key (delete forward) is 'x'.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; r&amp;lt;character&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt; Pressing 'r' would replace character under cursor with character pressed after 'r'. e.g., 'ra' would replace character under cursor with character 'a'.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; f&amp;lt;character&gt; &lt;br /&gt;&lt;/td&gt;&lt;td&gt; 'f' stands for Find and moves cursor forward to next occurrence of given character. &lt;p&gt; e.g., 'fa' would move cursor to next character 'a' in current line. &lt;p&gt; Variation: 'F' (capital f) searches backwards.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; $ &lt;br /&gt;&lt;/td&gt;&lt;td&gt; Move cursor to the end of current line.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; ^ &lt;br /&gt;&lt;/td&gt;&lt;td&gt; Move cursor to the beginning of current line.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; h, j, k, l &lt;/td&gt;&lt;br /&gt;&lt;td&gt; Move cursor to left, down, up and right correspondently. Very useful with repetition counter: e.g. '10h' (typed 10 followed by 'h') would move cursor ten characters left.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; w, e &lt;/td&gt;&lt;td&gt; Move cursor over words forward. 'w' stops at word beginnings. 'e' stops at word ends. 'W' and 'E' are the same, but they move backwards.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; d &lt;/td&gt;&lt;br /&gt;&lt;td&gt; Most dangerous command here. Or rather 'd' isn't command, but a modifier. Pressing 'd' before any motion command would delete characters/lines traveled.&lt;br /&gt;e.g. 'df&amp;lt;Space&gt;' would delete all characters from one under cursor till next Space (Space itself included).&lt;br /&gt;e.g. 'dl' would delete current character and one next to it. Analogous to 'xx' or '2x'.&lt;br /&gt;e.g. 'dj' would delete current line and one after it. Analogous to 'dddd' or '2dd'.&lt;br /&gt;e.g. 'd$' would delete characters starting from current one to the end of line. Analogous to 'D'.&lt;br /&gt;e.g. 'd/xxx' would delete characters starting with current one up to next entry of 'xxx' string in text (not including - search stops before - string itself).&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; dd &lt;/td&gt;&lt;td&gt; Delete current line.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; c &lt;/td&gt;&lt;td&gt; Change operator. Analogous to 'd', it deletes according to given motion, but after deletion switches to insert mode.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; cc &lt;/td&gt;&lt;td&gt; Clears current line and switches to insert mode.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; C &lt;/td&gt;&lt;td&gt; Clears line starting from character under cursor and switches to insert mode.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; i &lt;/td&gt;&lt;td&gt; Pressing 'i' would put vim into edit (insert) mode.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; R &lt;/td&gt;&lt;td&gt; Pressing 'R' (Shift-r) would put vim into replace mode (or in PC editors called "overwrite" mode). Unlike insert mode, where typing inserts characters, in replace mode any typed character would replace character under cursor.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt; A &lt;/td&gt;&lt;td&gt; Pressing 'A' (Shift-a) in command mode would make vi to go into insert mode and move cursor to end of line after last symbol.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt; That's about it. Move around with searches ('/' and 'f'), delete with 'x' or 'd'. Insert mode - 'i'. Replace mode - 'R'. Ctrl-[ - to go back to normal mode. Something went wrong - undo with 'u'. And of course ':w' to write changes and ':q' to exit.&lt;br /&gt;&lt;br /&gt;&lt;p&gt; &lt;b&gt;Edit1.&lt;/b&gt; He-he. As soon as I have written that I ended up working under the ever-sucking Solaris with its original vi whos &lt;a href="http://en.wikipedia.org/wiki/Bill_Joy"&gt;author&lt;/a&gt; needs to be shot dead 666 times to get him out of genetic pool - to make sure that no such thing would ever appear.&lt;br /&gt;&lt;br /&gt;&lt;p&gt; Another important point. Adding something at the end of something. This is next to impossible in original vi. With little bit of tinkering I came to conclusion that only way to do that is through substitution.&lt;br /&gt;&lt;br /&gt;&lt;p&gt; Add at the end of the line with &lt;code&gt; :s/$/ missing word./&amp;lt;Enter&gt;  &lt;/code&gt; (See also 'A')&lt;br /&gt;&lt;br /&gt;&lt;p&gt; Add new line with &lt;code&gt; :s/$/&amp;lt;^V&gt;&amp;lt;^M&gt;/&amp;lt;Enter&gt; &lt;/code&gt; (&amp;lt;^V&gt;&amp;lt;^M&gt; == Ctrl-V Ctrl-M == ^V says to terminal to insert next typed symbol (^M) verbatim. And ^M is "new line" symbol, which understood by vi as your intention to add a new line. (Enter under Unices is "carriage return")). Doing that on last line in file would add a new line after last.&lt;br /&gt;&lt;br /&gt;&lt;p&gt; Adding new line before first apparently can be done with &lt;code&gt; :s/^/&amp;lt;^V&gt;&amp;lt;^M&gt;/&amp;lt;Enter&gt; &lt;/code&gt; which is analoguos to previous trick - but instead of '$' (end of line) we substitute '^' (beginning of line).&lt;br /&gt;&lt;br /&gt;&lt;p&gt; Last words: Solaris muzz-die. It looks to me like my beloved &lt;a href="http://en.wikipedia.org/wiki/Belarus"&gt;Belarus&lt;/a&gt; which is often called a "reservation of communism." Same way, Solaris can be called a "reservation of Unix" - of all &lt;a href="http://en.wikipedia.org/wiki/The_UNIX-HATERS_Handbook"&gt;those mistakes made 30 years ago&lt;/a&gt;, fixed &lt;a href="http://en.wikipedia.org/wiki/Linux"&gt;everywhere&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/FreeBSD"&gt;else&lt;/a&gt;, with only Sun keeping them in place. For &lt;a href="http://www.google.com/search?hl=en&amp;q=Solaris+sucks&amp;btnG=Search"&gt;backward compatibility&lt;/a&gt; I gather.&lt;br /&gt;&lt;br /&gt;&lt;p&gt; &lt;b&gt;Edit2.&lt;/b&gt; Added '^' - moving to beginning of line.&lt;br /&gt;&lt;br /&gt;&lt;p&gt; &lt;b&gt;Edit3.&lt;/b&gt; Added 'A' - inserting text at end of line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7801939437109985233?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7801939437109985233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7801939437109985233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7801939437109985233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7801939437109985233'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/moving-around-in-vim-buggy-terminal.html' title='Moving around in VIM : buggy terminal edition'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-9121116713038438296</id><published>2007-05-29T06:35:00.000-07:00</published><updated>2007-05-29T11:27:12.169-07:00</updated><title type='text'>VIM Crash Course. Study #2.</title><content type='html'>OK. Recently, we have &lt;a href="http://vimrc-dissection.blogspot.com/2007/05/making-vim-easy-my-alternate-take-1.html"&gt;replaced a word in file&lt;/a&gt;. Now let's replace particular line in file.&lt;br /&gt;&lt;br /&gt;Example presumes you have open file you need to replace a line in.&lt;br /&gt;&lt;br /&gt;Line number is known and is 1234. (Or you can use '/' search operator from previous post to find the line.)&lt;br /&gt;&lt;br /&gt;1. &lt;code&gt;:1234&amp;lt;Return&gt;&lt;/code&gt;&lt;br /&gt;2. &lt;code&gt;C&lt;/code&gt;&lt;br /&gt;3. &lt;i&gt;&amp;lt;new text for given line&gt;&lt;/i&gt;&lt;br /&gt;4. &lt;code&gt;&amp;lt;Esc&gt;&lt;/code&gt;&lt;br /&gt;5. &lt;code&gt;:wq&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Explanation.&lt;br /&gt;&lt;br /&gt;1. Colon ':' allows us not only to input commands, but also to jump to particular line given by its number. Press colon, type line number and hit Enter. Cursor will be put on the first character in line number 1234. (Or last line, if number is too big.)&lt;br /&gt;&lt;br /&gt;2. 'C' would 'C'lear (delete all characters) starting from current one and put vim into insert mode. If cursor stands on first character in line - as it should after step 1 - it would clear whole line.&lt;br /&gt;&lt;br /&gt;3. Now type whatever you need to type in the line. After step 2 we are in insert mode  - to insert text. Any text you would type would appear verbatim.&lt;br /&gt;&lt;br /&gt;4. &amp;lt;Esc&gt; will put vim back into normal mode.&lt;br /&gt;&lt;br /&gt;5. ':wq' will write file and end editing session.&lt;br /&gt;&lt;br /&gt;Done!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-9121116713038438296?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/9121116713038438296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=9121116713038438296' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/9121116713038438296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/9121116713038438296'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/making-vim-easy-my-alternate-take-2.html' title='VIM Crash Course. Study #2.'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-1687665930736986744</id><published>2007-05-29T05:30:00.000-07:00</published><updated>2007-05-29T11:27:43.482-07:00</updated><title type='text'>VIM Crash Course. Study #1.</title><content type='html'>VIM (or equally VI) crash course #1: Correcting misspelled word AAA to BBB in a file "file-name".&lt;br /&gt;&lt;br /&gt;Most frustrating part in starting with vim (or vi) is that one often is forced to work with vim while there is no other editor on the system. That happens alot when working on some embedded system or antique unique boxes, which do have slimest and featureless editor installed. E.g. busybox or original vi from Bill Joy. To be frank, I'm also frustrated with the both things. But still they are cheap and thus are widespread. Making some use of them is only natural.&lt;br /&gt;&lt;br /&gt;Here we go.&lt;br /&gt;&lt;br /&gt;Launching: &lt;code&gt;vi file-name&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Commands needs to be typed as they a written here (without line numbers of course).&lt;br /&gt;&lt;br /&gt;1. &lt;code&gt;/AAA&amp;lt;Return&gt;&lt;/code&gt; &lt;br&gt;&lt;br /&gt;2. &lt;code&gt;n&lt;/code&gt; &lt;br&gt;&lt;br /&gt;3. &lt;code&gt;:s/AAA/BBB/&amp;lt;Return&gt;&lt;/code&gt; &lt;br&gt;&lt;br /&gt;4. &lt;code&gt;:wq&amp;lt;Return&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Explanation.&lt;br /&gt;&lt;br /&gt;1. '/' is search operator. Whatever you would type after it is search string. Search string is terminated (and search started) by pressing Enter. That will move cursor to place of first match. Or complain that string isn't found.&lt;br /&gt;&lt;br /&gt;2. Optional step, if found match isn't what you want to replace. 'n' repeats last search and moves cursor to next match in file. Press 'n' repeatedly, until you have found what you want to replace. With 'n' you can go over all matches in file and after hitting end of file, vim would restart search from the beginning of file.&lt;br /&gt;&lt;br /&gt;3. ':' colon is start of many commands in vim. 's' is short for "substitute" command. Its syntax is simple. 's' is followed by '/'. After first slash goes string you want to be replaced (or substituted). It is terminated by second '/'. After second slash goes replacement string. It is also optionally terminated by '/'. Pressing Enter would execute the substitution operation on current line, replacing first entry of AAA with BBB.&lt;br /&gt;&lt;br /&gt;4. ':wq' is vim's command to "write and quit". That would write modified file and leave vim.&lt;br /&gt;&lt;br /&gt;Notice, that the editing was done without switching into vi's infamous insert mode. The example doesn't use any kind of complex keys and guaranteed to work on all terminals.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-1687665930736986744?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/1687665930736986744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=1687665930736986744' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1687665930736986744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1687665930736986744'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/making-vim-easy-my-alternate-take-1.html' title='VIM Crash Course. Study #1.'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-2959044623997258264</id><published>2007-05-25T08:54:00.000-07:00</published><updated>2009-02-12T14:39:49.055-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] Making Vim easy</title><content type='html'>&lt;a href="http://www.linux.com/article.pl?sid=07/03/22/1236235"&gt;Tips: Making Vim easy&lt;/a&gt; by Joe 'Zonker' Brockmeier published on &lt;a href="http://linux.com/"&gt;Linux.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Though I can &lt;b&gt;not&lt;/b&gt; recommend using VIM in 'easy' mode (&lt;code&gt;:help easy&lt;/code&gt;). You would not learn VIM, nor would make it VIM really easier to you - most commands still require some level of knowledge of real vim modes.&lt;br /&gt;&lt;br /&gt;P.S. Somehow, most important shortcut Ctrl-L was left out of this introduction. Pressing Ctrl-L allows you to input a normal or ex command to vim. I guess that idea of easy vim is to not bother user with the modes and commands. Yet main power of vim - and the whole point of using it - is in the commands. Without Ctrl-L, vim in easy mode is pretty lame imitation of M$Windows infamous Notepad.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-2959044623997258264?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/2959044623997258264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=2959044623997258264' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2959044623997258264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/2959044623997258264'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/link-making-vim-easy.html' title='[link] Making Vim easy'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8238122662269043841</id><published>2007-05-23T09:08:00.000-07:00</published><updated>2007-05-23T09:33:03.890-07:00</updated><title type='text'>[off topic] Using GNU GDB for assembler</title><content type='html'>GNU GDB refuses to be good debugger for assembler. But still with some pain it is possible to get out of it something.&lt;br /&gt;&lt;br /&gt;But generally, I would advise learning to debug your programs right in your brains while you typing them. Think that's too complicated? Then read on. By end of the post you might be not that sure about that.&lt;br /&gt;&lt;br /&gt;0. Starting program. '&lt;code&gt;break *&amp;amp;_start&lt;/code&gt;' to set breakpoint at program entry point. 'run' as usual to actually load program.&lt;br /&gt;&lt;br /&gt;1. 'list' - forget about it. It will never ever show assembler. '&lt;code&gt;set language asm&lt;/code&gt;'? - HA-HA!! Naively thought you can outsmart GDB?? How naive of you. 'list' will &lt;b&gt;not&lt;/b&gt; work. Period.&lt;br /&gt;&lt;br /&gt;2. But how to see the code then?? Answer: '&lt;code&gt;disass $pc $pc+36&lt;/code&gt;'. $pc is content of register 'pc', what under PowerPC is 'program counter' - pointer to next instruction. (Probably pc is portable, have no clue.) Second parameter - $pc+36 - tells to disassembler to stop at address +36 (thus disassembling next 8 instructions, stopping at 9th).&lt;br /&gt;&lt;br /&gt;3. 'step' and 'next' will not work. I would have paid a premium to disable them altogether when I do use gdb for assembler, because they are screwing execution context in most unexpected way. You fingers slipped and typed 'n&amp;lt;Return&gt;'? Restart everything again - that way it's faster.&lt;br /&gt;&lt;br /&gt;4. 'stepi' and 'nexti' are used to walk instruction-wise.&lt;br /&gt;&lt;br /&gt;5. Breakpoints: '&lt;code&gt;break *0xdeadbeef&lt;/code&gt;', where &lt;code&gt;0xXXXXXXXX&lt;/code&gt; is address where you want to set a break point.&lt;br /&gt;&lt;br /&gt;Overall, you would hit snag at every corner. Yet, if you are courageous enough, my experience laid out here might serve as starting point.&lt;br /&gt;&lt;br /&gt;P.S. Interesting &lt;a href="http://www.ibm.com/developerworks/aix/library/au-gdb.html"&gt;article aboug GDB&lt;/a&gt; from IBM's developerWorks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8238122662269043841?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8238122662269043841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8238122662269043841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8238122662269043841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8238122662269043841'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/off-topic-using-gnu-gdb-for-assembler.html' title='[off topic] Using GNU GDB for assembler'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4143731826794446522</id><published>2007-05-23T07:00:00.000-07:00</published><updated>2007-05-23T07:39:38.092-07:00</updated><title type='text'>Hello World in VIM</title><content type='html'>OK, I feel myself empowered enough to actually write a "Hello World!" in VIM.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;function Hello(wrld)&lt;br /&gt;        let hw = "Hello ".a:wrld."!"&lt;br /&gt;        echo hw&lt;br /&gt;endfunction&lt;br /&gt;&lt;br /&gt;call Hello("World")&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Save that to &lt;code&gt;hw.vim&lt;/code&gt; and run this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ vim -u hw.vim -c ":q"&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It should print "Hello World!" and wait for you to press &lt;code&gt;Enter&lt;/code&gt; before quiting. (&lt;code&gt;-u hw.vim&lt;/code&gt; tells vim to load hw.vim as substitute of ~/.vimrc and &lt;code&gt;-c ":q"&lt;/code&gt; tells vim after loading ~/.vimrc (which is substituted with hw.vim) to execute ":q" to terminate.)&lt;br /&gt;&lt;br /&gt;Dissection. &lt;code&gt;:function&lt;/code&gt; &amp;amp; &lt;code&gt;:endfunction&lt;/code&gt; are start and end of function definition. &lt;code&gt;:let&lt;/code&gt; creates new variable &lt;code&gt;hw&lt;/code&gt; which contains string "Hello " concatenated with &lt;code&gt;a:wrld&lt;/code&gt; (function argument) and "!". (&lt;code&gt;:help :let&lt;/code&gt; describes operator '.' which is string concatenation operator.) &lt;code&gt;:echo&lt;/code&gt; is used to print the value contained in variable &lt;code&gt;hw&lt;/code&gt; to screen. If we pass as parameter "World" to the function, &lt;code&gt;hw&lt;/code&gt; would contain "Hello World!" string. &lt;br /&gt;&lt;br /&gt;N.B. Colon ':' before command names, when is inside of script file - e.g. ~/.vimrc - is optional and used by me here merely to highlight that commands are all from normal mode. Also when you say to VIM &lt;code&gt;:help :let&lt;/code&gt;, colon before &lt;code&gt;let&lt;/code&gt; would tell vim that you are interested precisely in &lt;code&gt;let&lt;/code&gt; command of normal mode - not something else. (Just like in &lt;code&gt;:help 'ts'&lt;/code&gt;, where single quotes tells vim to look for &lt;code&gt;ts&lt;/code&gt; only amongst settable options.)&lt;br /&gt;&lt;br /&gt;P.S. Adding that function to you ~/.vimrc with &lt;code&gt;call Hello($LOGNAME)&lt;/code&gt; would greet you with silly "Hello &amp;lt;Your-Login-Name-Here&gt;!" message every time you would launch vim.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4143731826794446522?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4143731826794446522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4143731826794446522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4143731826794446522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4143731826794446522'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/hello-world-in-vim.html' title='Hello World in VIM'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8353511466386864456</id><published>2007-05-23T04:37:00.000-07:00</published><updated>2007-05-23T06:58:00.367-07:00</updated><title type='text'>Simple string function in VIM</title><content type='html'>Recently I have posted a &lt;a href="http://vimrc-dissection.blogspot.com/2007/05/making-vim-and-ctags-real-friends-rev2.html"&gt;script for automatically picking up a ctags' tags file&lt;/a&gt;, if one found in obvious locations.&lt;br /&gt;&lt;br /&gt;New thing for me in the script is definition and calling of a user function. User functions in VIM are documented under &lt;code&gt;:help user-functions&lt;/code&gt; topic. (Standard functions are documented under &lt;code&gt;:help functions&lt;/code&gt;. Pressing ^] on function name would bring you to detailed description of corresponding function.)&lt;br /&gt;&lt;br /&gt;So, from POV of vimrc, function definition is simply set of commands, open with 'function Name([params])' line and closed with 'endfunction' line. Name must start with capital letter. Parameters are given as comma separated list - types are automagically deduced by VIM itself. Normally, most parameters would be strings and numbers - and VIM apparently can convert them silently one into another w/o bothering user about that (a-la Perl or JavaScript).&lt;br /&gt;&lt;br /&gt;Inside of function one puts normal VIM commands (&lt;code&gt;:help :normal&lt;/code&gt;). To access parameters, their names must be prefixed with 'a:' (&lt;code&gt;:help internal-variables&lt;/code&gt; has nice list of all prefixes.)&lt;br /&gt;&lt;br /&gt;To generate a value, function must use inside a &lt;code&gt;return&lt;/code&gt; command (&lt;code&gt;:help :return&lt;/code&gt;). Function will stop and callee would receive value given to return.&lt;br /&gt;&lt;br /&gt;Function found in .vimrc become global and available everywhere. Additionally one can put function definitions in external file and then call &lt;code&gt;:source&lt;/code&gt; to make them available (&lt;code&gt;:help :source&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;To call a function, one can use &lt;code&gt;:call&lt;code&gt; command:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;:call FindCtagsHere('/home/ifilipau/trunk/src/','/')&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;or simple &lt;code&gt;:echo&lt;/code&gt; (which also prints function return value):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;:echo FindCtagsHere('/home/ifilipau/trunk/src/','/')&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;or to save the value in variable one can use &lt;code&gt;:let&lt;/code&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;:let x=FindCtagsHere('/home/ifilipau/trunk/src/','/')&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;because (compared to simpler &lt;code&gt;:set&lt;/code&gt; used for options, &lt;code&gt;:let&lt;/code&gt; (used for generic variable manipulation) evaluates right side of assignment operator).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8353511466386864456?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8353511466386864456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8353511466386864456' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8353511466386864456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8353511466386864456'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/simple-string-function-in-vim.html' title='Simple string function in VIM'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-9075417964739022844</id><published>2007-05-22T05:43:00.000-07:00</published><updated>2007-05-22T06:29:16.056-07:00</updated><title type='text'>making vim and ctags real friends, rev2</title><content type='html'>Time have to review my little script from awhile ago to automatically update &amp;tags option with tag file if one is found in directory under current one.&lt;br /&gt;&lt;br /&gt;What bothered me that if I was opening file by full path, 'tags' option wasn't updated - since vim would be launched in $HOME, instead of directory were file itself resided. Thus script was failing to do anything.&lt;br /&gt;&lt;br /&gt;But today, I decided to waste whooooping 15 minutes to actually read VIM documentation and update my script. Now I use user functions to do the dirty job.&lt;br /&gt;&lt;br /&gt;Here we go.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;" 1&lt;br /&gt;function FindCtagsHere(dir, dir_sep)&lt;br /&gt;      let tag_dir = a:dir&lt;br /&gt;      let sep = a:dir_sep&lt;br /&gt;      while !filereadable(tag_dir.sep."tags") &amp;amp;&amp;amp; tag_dir!=$HOME &amp;amp;&amp;amp; stridx(tag_dir, sep)&gt;=0&lt;br /&gt;              let tag_dir = substitute(tag_dir, sep.'[^'.sep.']\+$', "", "")&lt;br /&gt;      endwhile&lt;br /&gt;      if filereadable(tag_dir.sep."tags")&lt;br /&gt;              return tag_dir.sep."tags"&lt;br /&gt;      else&lt;br /&gt;              return ''&lt;br /&gt;      endif&lt;br /&gt;endfunction&lt;br /&gt;&lt;br /&gt;" 2&lt;br /&gt;au BufReadPost *.cpp    let b:current_file_tags=FindCtagsHere(expand('%:p:h'),'/')&lt;br /&gt;au BufReadPost *.h      let b:current_file_tags=FindCtagsHere(expand('%:p:h'),'/')&lt;br /&gt;&lt;br /&gt;" 3&lt;br /&gt;au BufReadPost *        if exists("b:current_file_tags") &amp;amp;&amp;amp;&lt;br /&gt;\       filereadable(b:current_file_tags) &amp;amp;&amp;amp;&lt;br /&gt;\       stridx(&amp;amp;tags, b:current_file_tags)&amp;lt;0 | let &amp;amp;tags.=','.b:current_file_tags | endif&lt;br /&gt;&lt;br /&gt;" 4&lt;br /&gt;let x = FindCtagsHere(getcwd(), '/')&lt;br /&gt;if filereadable(x)&lt;br /&gt;       let &amp;amp;tags .= ','.x&lt;br /&gt;endif&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's it. (Blogger of course tries to eat '&amp;lt;' &amp;amp; '&amp;amp;' - so watch for syntax errors.)&lt;br /&gt;&lt;br /&gt;First I declare function. The function takes two parameters - directory to start search from and directory separator ('\\' for Windows (not tested!) and '/' for sane rest of the world). It returns string containing name of found tag file. Content was more or less copy-pasted from &lt;a href="http://vimrc-dissection.blogspot.com/2006/05/making-vim-and-ctags-real-friends.html"&gt;previous post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Second with 'au BufReadPost *.cpp/*.h' I add triggers to search for tags upon file loading. The tag file name is stored in buffer local variable 'b:current_file_tags'.&lt;br /&gt;&lt;br /&gt;Third with 'au BufReadPost *' I check to see if there was tag file found by earlier auto commands and if so I add the tag file into global option 'tags' (which is comma separated list of all tag files for VIM to check.)&lt;br /&gt;&lt;br /&gt;Fourth, lastly, I do restore original functionality of the script: if editor was launched even without files open, we search for tags starting from current directory. If tags were found we add them to 'tags' option. As before, launching VIM w/o files would allow to use ':tag' to browse code.&lt;br /&gt;&lt;br /&gt;Now we search for tags every time relevant file is open. This is added overhead, but I haven't noticed any visible slowdown from VIM. And my tags file is 300k lines &amp;amp; ~30MB big.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-9075417964739022844?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/9075417964739022844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=9075417964739022844' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/9075417964739022844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/9075417964739022844'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/making-vim-and-ctags-real-friends-rev2.html' title='making vim and ctags real friends, rev2'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-8031614446028810502</id><published>2007-05-22T01:47:00.000-07:00</published><updated>2007-05-22T02:23:10.774-07:00</updated><title type='text'>[off topic] Driving Principles of Programming: Ignorance</title><content type='html'>Well, I have already talked a bit about &lt;a href="http://vimrc-dissection.blogspot.com/2007/04/off-topic-driving-principles-of.html"&gt;laziness and egoism&lt;/a&gt;, but now time have come to mention - after all - the last (as I count them) third principle: ignorance.&lt;br /&gt;&lt;br /&gt;I was pitched to write this after whole week of meetings with two engineers, whose many questions may be rephrased as "what if sky falls down?" After several days I was ready to scream "As heck I care!!!" (and this is really polite form of what I actually wanted to say.)&lt;br /&gt;&lt;br /&gt;I have a function to do task A. WTF shall I care here about B, C and D??? Some people just do not get it.&lt;br /&gt;&lt;br /&gt;IGNORANCE. The ignorance which is bliss. As programming concerned, ignorance allows programmer to concentrate on particular task, ignoring ever-changing environment his program is ought to work in. Otherwise, if one would try to track all new requirements and developments, his/her attention would be diverted from original task. End result? Task would be always in half finished state.&lt;br /&gt;&lt;br /&gt;Egoism and ignorance are very similar. Egoism tells us to ignore other's opinion (a.k.a. critics). Ignorance tells us to ignore other's problems (a.k.a. new requirements).&lt;br /&gt;&lt;br /&gt;Like with other two principles, all is good in moderation. Pushing any of the principles to the limit of course goes against the laziness principle. And being too lazy would mean that you are not egoistic. And being too egoistic would mean that you can't ignore yourself. You see now? That's vicious circle of software development. ;)&lt;br /&gt;&lt;br /&gt;P.S. How to use ignorance in practice. Ignorance normally results in task-oriented applications. You do not try to do everything - since you ignore everything - but concentrate on precisely the task/job you want to accomplish. Often such applications might look as hairy agglutinations of functions - and they are really functional and do what you want from them. Though lazy guys like I am would find them short on ergonomics ^_^&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-8031614446028810502?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/8031614446028810502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=8031614446028810502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8031614446028810502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/8031614446028810502'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/off-topic-driving-principles-of.html' title='[off topic] Driving Principles of Programming: Ignorance'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6897796213821844772</id><published>2007-05-20T06:35:00.000-07:00</published><updated>2007-05-20T06:57:53.693-07:00</updated><title type='text'>[off topic] Perl v. Python: Python Sucks!</title><content type='html'>Results of my non-scientific research: "Python sucks". Or rather Python performance does suck big time. Or rather lack of performance.&lt;br /&gt;&lt;br /&gt;Simple test.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ cat a.py&lt;br /&gt;print "Hello world!"&lt;br /&gt;$ time python a.py&lt;br /&gt;Hello world!&lt;br /&gt;&lt;br /&gt;real    0m0.039s&lt;br /&gt;user    0m0.032s&lt;br /&gt;sys     0m0.008s&lt;br /&gt;$&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Compare to this:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ cat a.pl&lt;br /&gt;print "Hello World!\n";&lt;br /&gt;$ time perl a.pl&lt;br /&gt;Hello World!&lt;br /&gt;&lt;br /&gt;real    0m0.008s&lt;br /&gt;user    0m0.004s&lt;br /&gt;sys     0m0.004s&lt;br /&gt;$&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;or this:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ cat a.c&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;    printf("Hello World!\n");&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;br /&gt;$ make a &amp;&amp;amp; time ./a&lt;br /&gt;gcc   a.c   -o a&lt;br /&gt;Hello World!&lt;br /&gt;&lt;br /&gt;real    0m0.003s&lt;br /&gt;user    0m0.000s&lt;br /&gt;sys     0m0.000s&lt;br /&gt;$&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I mean, what Python does those 40ms? Compared to Perl's 4ms? Or C's ZILCHms?&lt;br /&gt;&lt;br /&gt;Absolute values seem to be small enough to be disregarded. But the same cliche can be seen in bigger applications.&lt;br /&gt;&lt;br /&gt;For example &lt;a href="http://www.gentoo.org/"&gt;Gentoo&lt;/a&gt;'s tool chain - &lt;a href="http://gentoo-wiki.com/MAN_emerge"&gt;emerge&lt;/a&gt; - many Gentoo users are familiar with. Its DARN slow. Even compared to &lt;a href="http://www.debian.org/"&gt;Debian&lt;/a&gt; system - &lt;a href="http://www.debian.org/doc/manuals/apt-howto"&gt;apt-get&lt;/a&gt; - which does so much more and often labeled by jealous RedHat folks "amateurish" - works magnitudes faster (and even on junk hardware).&lt;br /&gt;&lt;br /&gt;Or &lt;a href="http://www.scons.org/"&gt;SCons&lt;/a&gt;. SCons take 1.5 seconds to just start up and print help message. It's Perl's sibling &lt;a href="http://www.gnu.org/software/cons/"&gt;cons&lt;/a&gt;/&lt;a href="http://www.baldmt.com/parallel-cons/"&gt;pcons&lt;/a&gt; in the time manages to compile several sources.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6897796213821844772?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6897796213821844772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6897796213821844772' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6897796213821844772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6897796213821844772'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/off-topic-perl-v-python-python-sucks.html' title='[off topic] Perl v. Python: Python Sucks!'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-5397759245749909996</id><published>2007-05-16T13:59:00.000-07:00</published><updated>2009-02-12T14:40:12.368-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] Vi Lovers Home Page</title><content type='html'>&lt;a href="http://thomer.com//vi/vi.html"&gt;Vi Lovers Home Page&lt;/a&gt; - terrific resource for everybody. Piles of links - tutorials and FAQs.&lt;br /&gt;&lt;br /&gt;Must read.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-5397759245749909996?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/5397759245749909996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=5397759245749909996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5397759245749909996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5397759245749909996'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/link-vi-lovers-home-page.html' title='[link] Vi Lovers Home Page'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-6884460936454890017</id><published>2007-05-16T10:59:00.000-07:00</published><updated>2009-02-12T14:40:19.946-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>[link] Gentoo's VI guide</title><content type='html'>&lt;a href="http://www.gentoo.org/doc/en/vi-guide.xml"&gt;Learning vi&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Pretty good for beginners - just like about any other document I have seen from Gentoo.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-6884460936454890017?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/6884460936454890017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=6884460936454890017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6884460936454890017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/6884460936454890017'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/link-gentoos-vi-guide.html' title='[link] Gentoo&apos;s VI guide'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-7144563957074940951</id><published>2007-05-04T08:09:00.000-07:00</published><updated>2007-05-04T08:12:57.961-07:00</updated><title type='text'>[off topic] Divide and Conquer (DaC) vs. Model-View-Controller (MVC)</title><content type='html'>&lt;p style="margin-bottom: 0cm;"&gt;Thinking about team work organization, I was constantly humming "Divide and Conquer" (DaC) principle. That's pretty obvious since it is guiding principle how big teams are taking on large problems - by splitting them into many smaller ones. (Small enough for single person to solve.)&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;Turning back to work, my eyes have met again with several of my constructs loosely based on MVC model.&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;Sudden enlightenment: MVC is another application of more general DaC.&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;How DaC works. A (simple) problem is split into three (primitive) problems:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;2 smaller problems of original  bigger problem and (one more piece everybody forgets about)&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;problem of integration the two  smaller solutions into solution for bigger problem.&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin-bottom: 0cm;"&gt;The third part - often forgotten line connecting two blocks - is very important and often play crucial development organization role. Recurrently applying DaC we can slice problems until they reach manageable size.&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;How MVC works. A problem is split into three problems:  &lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;stateful part containing all  data/state (model),&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;stateless part containing all  utilities needed to work with model (view) and&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;controller part which best  exemplified by UI to manage the data of model using the utility of  view.&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin-bottom: 0cm;"&gt;MVC generally drawn as three blocks, with model being independent, view depending solely on model and controller depending on both model and view.&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;Similarities are obvious.&lt;br /&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;On high level, MVC's controller is the interface connecting the two pieces of problem - model (state) and view (functions). (Bigger problem split into two smaller problems - model and view - with controller playing role of integration problem.)&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;On lower level, MVC looks like DaC splitting original problem into three smaller problems and plus three more integration problems (view to model, controller to view and to model).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-7144563957074940951?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/7144563957074940951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=7144563957074940951' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7144563957074940951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/7144563957074940951'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/off-topic-divide-and-conquer-dac-vs.html' title='[off topic] Divide and Conquer (DaC) vs. Model-View-Controller (MVC)'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4718820187147389902</id><published>2007-05-01T05:23:00.000-07:00</published><updated>2007-05-01T05:28:18.907-07:00</updated><title type='text'>Clever tricks from VIM's Bram Moolenaar</title><content type='html'>The page where I found tip for the annoying PuTTY problem, also had great tip:&lt;br /&gt;&lt;blockquote&gt;:help usr_12.txt&lt;/blockquote&gt;There you will find clever tricks you can do with VIM to accomplish simple yet sometimes needed tasks. And overall page has lots of simple hints. Very good reading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4718820187147389902?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4718820187147389902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4718820187147389902' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4718820187147389902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4718820187147389902'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/clever-tricks-from-vims-bram-moolenaar.html' title='Clever tricks from VIM&apos;s Bram Moolenaar'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-3230755807819721094</id><published>2007-05-01T05:11:00.000-07:00</published><updated>2007-09-19T04:46:08.090-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='broken terminal'/><title type='text'>VIM vs. PuTTY keypad</title><content type='html'>The problem was annoying me for very long time: under PuTTY, applications (e.g. less, vim) using tek window (alternative terminal screen) had totally screwed keypad. Solution was found &lt;a href="http://chrislent.googlepages.com/gettingnumbersfromnumerickeypadinvim"&gt;here&lt;/a&gt;.&lt;br /&gt;Apparently, PuTTY tries to do something smart. And fails.&lt;br /&gt;Workaround:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Change function key/keypad mapping from standard "ESC[n~" to "Linux".&lt;/li&gt;&lt;li&gt;Disable application keypad mode&lt;/li&gt;&lt;/ol&gt;Apparently only second is required, but first is also recommended.&lt;br /&gt;The options, as usual to all options of Windows applications, change their location in settings dialog periodically so I cannot give their precise locations. Go through PuTTY setting and you will find them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-3230755807819721094?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/3230755807819721094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=3230755807819721094' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3230755807819721094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/3230755807819721094'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/05/vim-vs-putty-keypad.html' title='VIM vs. PuTTY keypad'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-1995881349375514446</id><published>2007-04-30T02:23:00.000-07:00</published><updated>2007-04-30T07:44:26.175-07:00</updated><title type='text'>[off topic] Driving Principles of Programming</title><content type='html'>I often asked on how software development works. To most people unfamiliar with all stinky innards of development process, figuring out how to get anything out of developers is very very tricky. Sometimes people see logic behind what I do - but often they are lost when trying to deal with me.&lt;br /&gt;&lt;br /&gt;So as an insight into developer's head I would explain shortly here two of my software development principles. "Shortly" and "two" - because I have managed to date to formulate only one (second) of them and first was well know before I was even born.&lt;br /&gt;&lt;br /&gt;1. This is grand principle which regulates lion share of decisions made by software developer. &lt;span style="font-weight: bold;"&gt;LAZINESS&lt;/span&gt;. Some think of it as of bad habit, but in as old programmers' proverb goes to find simplest solution to a problem, assign the problem to laziest programmer you have. In development and programming, laziness is source of all simple decisions which are often by outsiders are seen as "original" or even "genius". To programmers - it's just N days of work saved.&lt;br /&gt;&lt;br /&gt;1a. Corollary. In development team with no lazy people, one would hardly see any innovation - or properly working program. After all, non-lazy people can make even &lt;a href="http://www.faqs.org/rfcs/rfc1925.html"&gt;pigs flying&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;2. It just dawned on me recently and I have managed to formulate my second most used programming principle. &lt;span style="font-weight: bold;"&gt;EGOISM&lt;/span&gt;. (I would claim nothing and rather expect that somebody already did research that before me.) The principle is very simple: make something what would be useful to you and most likely others would find it also useful. Check the Unix made of thousands of small and big utilities - most of the utilities were initially developed for particular purpose of its author himself. But later were also found by others to be useful. Well, Unix itself was made for very particular purpose - and none of its developers even thought that Unix would catch up. Yet it did. Why? Because first and foremost it was useful to its creators. They didn't cared much what others did with it - how egoistic of them!? ;)&lt;br /&gt;&lt;br /&gt;2a. Corollary. Excessive non-egoistic programming results in piles of abstract interfaces made to abstract other interfaces which abstract other interfaces. They do not do anything in particular - they are written often because people are told to write something. It is hard to make something useful - if you are just a little gear which needs only to mesh with other such gears. And to mesh better  - we need more interfaces, abstraction layers and &lt;a href="http://www.faqs.org/rfcs/rfc1925.html"&gt;level of indirection&lt;/a&gt;. It also happens to be a generic sickness of many successful projects which in beginning "just work", but authors along the way get bored and start adding needless minor features (by request of vocal user minority) which in the end obstruct core functionality. Program was started as something working - thus became popular. Later on to satisfy needs of few others (here ended the egoism!) features added were not needed by authors themselves (nor (as usually!) were properly communicated by end users to developers) thus ended up being implemented poorly.&lt;br /&gt;&lt;br /&gt;That's it for today.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-1995881349375514446?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/1995881349375514446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=1995881349375514446' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1995881349375514446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/1995881349375514446'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/04/off-topic-driving-principles-of.html' title='[off topic] Driving Principles of Programming'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-5100444313737022438</id><published>2007-04-09T04:48:00.000-07:00</published><updated>2007-04-09T05:16:14.961-07:00</updated><title type='text'>[off topic] [rants] GNU Make - missing features</title><content type='html'>&lt;ol&gt;&lt;li&gt;For all "declaration" nature of make, it is still very very hard to build your own rule out of predefined ones found in make database. e.g. making a rule for new file extension to call existing rule for older file extension is only possible with dumb copy-and-pasting. Now imaging project with hundreds makefiles - all at different times doing such copy-and-pasting: one hell to do maintenance.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Arithmetics. I was really surprised to find that make doesn't have any internal facility for arithmetic expression calculation. Even more so I was surprised when I learned that GNU project doesn't even have such library. Best call - is to call external optional program 'dc' or hope that bash is installed and do arithmetics through it. That bars many accessibility features like progress counter for long build processes. Also obviously renders makefiles unportable.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Clean mechanism to overwrite rules. That's actually what makes proper dependency check implementation impossible. E.g. if you have dependency "a: b" and "a: c" that would really mean "a: b c" - and there is no way to cancel the "a: b" dependency.&lt;/li&gt;&lt;li&gt;List and string routines. Again, mere convenience, yet has performance impact. To put it simply: it is very stupid when to transform file name I have to call several external programs. String manipulation is needed for file name transformations. List routines are needed for proper management of list of targets scheduled to build.&lt;/li&gt;&lt;li&gt;Recursiveness. The dead horse was beaten many times before. Lack of proper recursiveness support bars use of make on very large projects. Or leads to arcane make files understood by few thus having very very low accessibility. One can't require everybody on project to be a make specialist.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Looking at all the rants, my mind instantly points out that the list is precisely difference between make and &lt;a href="http://directory.fsf.org/cons.html"&gt;cons&lt;/a&gt;. Last update to cons - &lt;a href="http://www.baldmt.com/parallel-cons/"&gt;pcons&lt;/a&gt; - was in 2001 and (thanks to that fact that it was written in Perl) it still works perfectly in all situations I have been to.&lt;br /&gt;&lt;br /&gt;I had very ridiculous accident: people using pcons were told to switch to make ("Of course there is no reasons to it - it is just our corporate policy"). Case looked bleak: dumbing down build system back to stone age of make wasn't problem - problem was the lost functionality (the list above). I have advised (and it actually worked) simple solution: put pcons right along with sources and create makefiles with all targets calling cons instead. Worked beautifully - thanks to slim nature of cons/pcons which is written in Perl and has little/no external dependencies.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-5100444313737022438?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/5100444313737022438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=5100444313737022438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5100444313737022438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5100444313737022438'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/04/off-topic-rants-gnu-make-missing.html' title='[off topic] [rants] GNU Make - missing features'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4319778890769212982</id><published>2007-04-09T04:10:00.000-07:00</published><updated>2007-04-09T04:28:14.634-07:00</updated><title type='text'>[off topic] One-liner to make GNU Info usable</title><content type='html'>Something like this should be shipped along with GNU Info documentation system - to make it any useful:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ cat ~/usr/bin/iinfo&lt;br /&gt;#!/bin/bash&lt;br /&gt;info --subnodes --output=- "$@" 2&gt;/dev/null | less&lt;br /&gt;$&lt;/pre&gt; &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Option "--subnodes" tells info to dump everything it has - w/o frigging inhuman document structure. Option "--output=-" tells to dump that all on stdout. The bit "2&gt;/dev/null" is to shut up the stupid useless stuff info spits on stderr. And '| less' bit tells it to behave like proper "man".&lt;br /&gt;&lt;br /&gt;Rants. Ironically, even the one-liner cannot make GNU tools any better: they show their age, were not updates in years and do not support most modern things one expects. Searching internet generally brings more and better results than digging outdated GNU documentation. (N.B. GCC of all GNU tools is kind of exception.)&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4319778890769212982?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4319778890769212982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4319778890769212982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4319778890769212982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4319778890769212982'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/04/off-topic-one-liner-to-make-gnu-info.html' title='[off topic] One-liner to make GNU Info usable'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-5688860777167780263</id><published>2007-02-27T01:32:00.000-08:00</published><updated>2007-03-09T04:39:45.984-08:00</updated><title type='text'>[off topic] message logging severities</title><content type='html'>I can recall only five levels of severities:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MAJOR&lt;/span&gt;: Alarm. Critical unrecoverable error. Results in certain termination of application.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MINOR&lt;/span&gt;: Recoverable error. Application can go on, but something is fishy.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTICE&lt;/span&gt;: Not an error, but shouldn't have happened.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;INFO&lt;/span&gt;: Run-time information statistics, "anomalies" a.k.a. unsolicited messages. Must produce passable amount of information since might be used for monitoring of real system.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TRACE&lt;/span&gt;: Used to trace what's happening in the system: functions called and their arguments. Produces insane amount of output.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DEBUG&lt;/span&gt;: Debugging info. Developer's corner.&lt;br /&gt;&lt;br /&gt;Production systems run on MINOR level, so that all errors are displayed. MAJOR level normally has abort() built in so that OS would dump core of application for further investigations.&lt;br /&gt;&lt;br /&gt;Systems in testing run with INFO level. Often the output is saved and required to match in repeated tests. E.g. if we have fed application with 1000 bytes of info, we would expect INFO message to reflect that 1000 bytes where handled. Not 999, not 1001, not 500 + 500.&lt;br /&gt;&lt;br /&gt;Edit1: Added "TRACE" level.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-5688860777167780263?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/5688860777167780263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=5688860777167780263' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5688860777167780263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/5688860777167780263'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/02/off-topic-message-logging-severities.html' title='[off topic] message logging severities'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-4666835121009839532</id><published>2007-02-01T10:23:00.000-08:00</published><updated>2007-03-26T04:05:24.735-07:00</updated><title type='text'>Off-Topic :: Wait-Free/Lock-less synchronization crash course</title><content type='html'>Well, results are not that good as I have hoped. (&lt;a href="http://en.wikipedia.org/wiki/Compare_and_swap"&gt;In depth info at Wikipedia&lt;/a&gt;. Read the first reference on the page written by Maurice Herlihy in 1993.)&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Rule of thumb: lock-less can only be data structures which synchronize using single datum.&lt;/li&gt;&lt;li&gt;Compare-And-Swap( ptr, old, new ) can be used for implementation of atomic counters. The operation is supported by all high performance platforms (e.g. PowerPC &amp;amp; IA-32).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;One cannot make lock-less FIFO for N:M (N readers/M writers) nor for 1:M (1 reader/M writers) configurations. Seems that 1:1 (1 read and 1 writer) only possible configuration and in fact it doesn't require any special support at CPU level. (Reference to rule of thumb: FIFO requires two data items for implementation - head/tail (or next/prev).)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Stack (LIFO) can be implemented wait-free/lock-less using Compare-And-Swap() op, since it needs only single pointer for implementation - head - pointing to first element to remove/last element inserted.&lt;/li&gt;&lt;/ol&gt;Conclusion:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Unixes were 100% right putting pipes at foundation of I/O: pipe can be implemented as couple of FIFOs and as long as pipe isn't shared between more than 2 applications, it can be completely lock free.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Stack (along with Compare-And-Swap op) allows to implement memory management (for static block size) very efficiently. (Edit1. In preemptive SMP OS, that might lead to situation when Compare-And-Swap would succeed despite fact that state of queue already changed. Proper implementation for multiple CPUs would use several (at minimum 2) stacks. Allocations are made from one stack, freeing is done on next stack. Allocation function rotates stacks when detects that current stack is empty. Allocation is failed when all stacks were queried at least once and all are empty. Alternatively, one can introduce additional counter: generation counter. That way Compare-And-Swap needs to be able to write double word. When element is allocated, generation counter is incremented. When element is freed, we put on stack pair - pointer and generation counter - which would be with high probability unique.)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Message passing systems suck big time because (i) 1:1 FIFOs are inapplicable and (ii) it is impossible to optimize memory allocation with lock-less stack since it is impossible to tell where the message would end up. (The later can only be implemented in worst case scenario of shared memory.)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-4666835121009839532?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/4666835121009839532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=4666835121009839532' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4666835121009839532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/4666835121009839532'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/02/off-topic-wait-freelock-less.html' title='Off-Topic :: Wait-Free/Lock-less synchronization crash course'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-400895970555082530</id><published>2007-01-29T01:35:00.000-08:00</published><updated>2007-01-29T01:42:48.825-08:00</updated><title type='text'>vim 7.0 :: tabs / tabbed editing</title><content type='html'>Not that I fun of all the GUI niceties, but some people cannot live without mouse and think &lt;code&gt;:b#&lt;/code&gt;/&lt;code&gt;:bn&lt;/code&gt;/&lt;code&gt;:bp&lt;/code&gt; are bore. So vim7 has added a way for mouse fans (*) to work with multiple files.&lt;br /&gt;&lt;br /&gt;For tab fans, Linux.com published intro into vim7' tabs: &lt;a href="http://www.linux.com/article.pl?sid=07/01/11/2141259"&gt;Vim tips: Using tabs&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;(*) How people edit text files with mouse is beyond me. Do they use &lt;a href="http://www.google.com/images?q=charmap"&gt;charmap&lt;/a&gt; or what? [/sarcasm]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-400895970555082530?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/400895970555082530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=400895970555082530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/400895970555082530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/400895970555082530'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2007/01/vim-70-tabs-tabbed-editing.html' title='vim 7.0 :: tabs / tabbed editing'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-116404265404506997</id><published>2006-11-20T09:10:00.000-08:00</published><updated>2011-12-19T15:24:12.134-08:00</updated><title type='text'>Sample Ex/Vim Ranges</title><content type='html'>Here we go.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:%s/[a-z]/\u&amp;/g&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;del&gt;Substitute in all lines (the range defined by '%') all lower case latin letters ('[a-z]') with upper case letters ('[A-Z]').&lt;/del&gt; Substitute in all lines (the range defined by '%') every lower case latin letter ('[a-z]') with upper-case letter ('\u&amp;', see for more info &lt;code&gt;:h s/\u&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:&amp;lt;'&amp;gt;' w new_file_from_selection.txt&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Write ('w') all selected lines ("&amp;lt;'&amp;gt;'") into new_file_from_selection.txt. (You do not need to type that "&amp;lt;'&amp;gt;'" thing. Select lines in visual mode (entered by Shift-V) and then press ':' - vim will put the &amp;lt;'&amp;gt;' in prompt line for you)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:5,+99 w new_file.txt&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Write ('w') to the file "new_file.txt" lines: 5th and next 99 ones included, total of 100 lines. (Provided that the actual file has minimum 10&lt;strike&gt;5&lt;/strike&gt;4 lines).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:0,$ ! tac&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Filter ('!') all lines ('%' is simple shortcut for '0,$') through the external application 'tac'. The filter command would then replace all affected lines with the output of the application - in that case the lines would reappear in inverse order, thanks to the 'tac' command. ('tac' is of course opposite of 'cat'. man tac.).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:&amp;lt;'&amp;gt;' ! wc -l&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That would replace all selected (in visual mode) lines with the count of selected lines, as counted by 'wc -l'.&lt;br /&gt;&lt;br /&gt;And to conclude, the most useless (unless you're vim scripting addict) range example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:.=&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Print current line (range '.') number (command '=').&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Edit1&lt;/i&gt; Fix the uppercase command, as per anon comment. It should have been some real weird booze I had that day. N.B. more optimal is of course this: &lt;code&gt;:%s/.\+/\U&amp;/&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;p align="right"&gt;&lt;i&gt;ZQ&lt;/i&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-116404265404506997?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/116404265404506997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=116404265404506997' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116404265404506997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116404265404506997'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/11/sample-exvim-ranges.html' title='Sample Ex/Vim Ranges'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-116180838715727384</id><published>2006-10-25T13:31:00.000-07:00</published><updated>2006-10-25T13:33:07.186-07:00</updated><title type='text'>[Linux.com] Vim tips: Working with external commands</title><content type='html'>&lt;a href=http://www.linux.com/article.pl?sid=06/10/10/2123208&gt;Vim tips: Working with external commands&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-116180838715727384?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/116180838715727384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=116180838715727384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116180838715727384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116180838715727384'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/10/linuxcom-vim-tips-working-with.html' title='[Linux.com] Vim tips: Working with external commands'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-116135157535941810</id><published>2006-10-20T06:37:00.000-07:00</published><updated>2007-03-16T03:23:03.822-07:00</updated><title type='text'>Off Topic :: GNU Arch (TLA) Commands Quick Reference</title><content type='html'>&lt;p&gt;User identification&lt;/p&gt;&lt;pre&gt;$ tla my-id  "John Doe &amp;lt;user@aol.com&amp;gt;"&lt;br /&gt;$ tla my-id                       # to print currently set id&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Create Archive&lt;/p&gt;&lt;pre&gt;$ mkdir  ~/{archives}&lt;br /&gt;$ tla make-archive  user@aol.com--2006-quickref ~/{archives}/2006-quickref&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Find Archives&lt;/p&gt;&lt;pre&gt;$ tla archives                    # to print all available archives&lt;br /&gt;$ tla whereis-archive user@aol.com--2006-quickref&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Default Archive&lt;/p&gt;&lt;pre&gt;$ tla  my-default-archive  user@aol.com--2006-quickref&lt;br /&gt;$ tla  my-default-archive         # to print it&lt;br /&gt;$ tla  my-default-archive -d      # to delete the preference&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Provisioning Archive Space&lt;/p&gt;&lt;pre&gt;$ tla archive-setup hello-world--mainline--1.0&lt;br /&gt;$ tla categories                  # prints hello-world&lt;br /&gt;$ tla branches hello-world        # prints hello-world--mainline&lt;br /&gt;$ tla versions hello-world--mainline        # prints hello-world--mainline--1.0&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Initializing before Import&lt;/p&gt;&lt;pre&gt;$ cd ~/wd/hello-world&lt;br /&gt;$ tla init-tree hello-world--mainline--1.0&lt;br /&gt;$ tla tree-root                   # prints /home/jdoe/wd/hello-world&lt;br /&gt;$ tla tree-version                # prints user@aol.com--2006-quickref/hello-world--mainline--1.0&lt;br /&gt;$ tla log-versions                # prints user@aol.com--2006-quickref/hello-world--mainline--1.0&lt;br /&gt;$ tla set-tree-version [new-version-name]&lt;br /&gt;$ tla add-log-version [new-log-name]&lt;br /&gt;$ tla remove-log-version [existing-log-name]&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Checking Inventory&lt;/p&gt;&lt;pre&gt;$ tla inventory --names --source  # to see what arch classifies as sources&lt;br /&gt;$ tla inventory --source --ids    # to see ids given by arch to sources&lt;br /&gt;$ tla inventory --names --backups # to see what arch classifies as backups&lt;br /&gt;$ tla inventory --junk | xargs rm # remove all what arch think is junk&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Adding/Removing Files&lt;/p&gt;&lt;pre&gt;$ tla add hw.c main.c&lt;br /&gt;$ tla delete hw.c&lt;br /&gt;$ mv hw.c hello.c&lt;br /&gt;$ tla move hw.c hello.c&lt;br /&gt;$ tla tree-lint   # to see if all clean, tla won't import/ci from unclean directory&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Import (Initial check in)&lt;/p&gt;&lt;pre&gt;$ tla make-log                    # create log file and print its name&lt;br /&gt;$ vim `tla make-log`              # edit log in vim&lt;br /&gt;$ tla import                      # copy working copy into archive&lt;br /&gt;$ tla revisions hello-world--mainline--1.0  # prints base-0&lt;br /&gt;$ tla revisions --summary --creator --date hello-world--mainline--1.0&lt;br /&gt;$ tla log-revisions&lt;br /&gt;$ tla logs hello-world--mainline--0.1       # prints base-0&lt;br /&gt;$ tla logs --summary --creator --date hello-world--mainline--1.0&lt;br /&gt;$ tla cat-log hello-world--mainline--1.0--base-0&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Committing Changes&lt;/p&gt;&lt;pre&gt;$ tla changes --diffs             # or (in tla 1.3) just "tla diff"&lt;br /&gt;$ tla make-log                    # create log, required&lt;br /&gt;$ tla commit                      # do it, creates patch-1&lt;br /&gt;$ tla commit -s "Summary" -L "Log Message"            # commit with log auto generated&lt;br /&gt;$ tla revisions --summary hello-world--mainline--1.0  # last revision info&lt;br /&gt;$ tla logs --summary hello-world--mainline--1.0       # last log entry info&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Checking Out&lt;/p&gt;&lt;pre&gt;$ tla my-default-archive          # check where is default archive is&lt;br /&gt;$ tla whereis-archive user@aol.com--2006-example      # display local/net path&lt;br /&gt;$ tla categories        # lists available project in default archive "hello-world"&lt;br /&gt;$ tla branches hello-world        # lists available branches of the project "*--mainline"&lt;br /&gt;$ tla versions hello-world--mainline        # lists available version of the branch "*--0.1"&lt;br /&gt;$ tla revisions hello-world--mainline--0.1  # lists available revisions base-0 &amp;amp; patch-1&lt;br /&gt;$ tla get hello-world--mainline--0.1 hello-world                # check out most recent revision of into "hello-world" directory, or&lt;br /&gt;$ tla get hello-world--mainline--0.1--base-0 hello-world        # check out specific revision&lt;br /&gt;$ ls                    # should list "hello-world"&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Update (Replay)&lt;/p&gt;&lt;pre&gt;$ tla undo              # back off local changes&lt;br /&gt;$ tla replay            # get latest patches from repository&lt;br /&gt;$ tla redo              # reapply local changes&lt;br /&gt;$ tla update            # all of three steps above with one command.&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Networked Archives&lt;/p&gt;&lt;pre&gt;$ tla register-archive lord@emf.net--2003b          &lt;br /&gt;   http://regexps.srparish.net/{archives}/lord@emf.net--2003b    # HTTP, R/O&lt;br /&gt;$ tla register-archive lord@regexps.com--2002&lt;br /&gt;   ftp://ftp.regexps.com/{archives}/lord@regexps.com--2002       # FTP, R/W&lt;br /&gt;$ tla register-archive user@aol.com--2006&lt;br /&gt;   sftp://random.homeunix.org/home/jdoe/{archives}/2006-quickref # SFTP, R/W&lt;br /&gt;$ tla my-default-archive [archive-name]      # and the rest is just like described above&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Mirroring (Locally) Network Archives&lt;/p&gt;&lt;pre&gt;$ tla register-archive lord@emf.net--2003b-SOURCE $remote_location   # once&lt;br /&gt;$ tla make-archive --mirror-from lord@emf.net--2003b-SOURCE $local_location # once&lt;br /&gt;$ tla archive-mirror lord@emf.net--2003b    # repeat to pull latest changes&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Mirroring (Remotely) Local Archives&lt;/p&gt;&lt;pre&gt;$ tla make-archive --mirror mine@somewhere.com $remote_location      # once&lt;br /&gt;$ tla archive-mirror mine@somewhere.com     # repeat to push latest changes&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;P.S. Made after &lt;a href="http://www.gnu.org/software/gnu-arch/tutorial-old/arch.html"&gt;this tutorial&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-116135157535941810?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/116135157535941810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=116135157535941810' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116135157535941810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116135157535941810'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/10/off-topic-gnu-arch-tla-quick.html' title='Off Topic :: GNU Arch (TLA) Commands Quick Reference'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-116118998588329050</id><published>2006-10-18T09:43:00.000-07:00</published><updated>2006-10-18T09:46:25.896-07:00</updated><title type='text'>More from that Oualline person</title><content type='html'>&lt;a href="http://www.oualline.com/10/top_10.html"&gt;Top 10 things Vi user need to know about Vim&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Very short and clear.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-116118998588329050?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/116118998588329050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=116118998588329050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116118998588329050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116118998588329050'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/10/more-from-that-oualline-person.html' title='More from that Oualline person'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-116068011307172554</id><published>2006-10-12T11:57:00.000-07:00</published><updated>2006-10-12T12:08:33.086-07:00</updated><title type='text'>Vim Cookbook by Steve Oualline</title><content type='html'>&lt;a href="http://www.oualline.com/vim-cook.html"&gt;Vim Cookbook&lt;/a&gt; by Steve Oualline. Interesting reading. Lots of little tips.&lt;br /&gt;&lt;br /&gt;P.S. Delves a bit into ranges supported in ex commands. I still cannot get myself to write entry on &lt;a href="http://www.vim.org/htmldoc/cmdline.html#[range]"&gt;vim ranges&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-116068011307172554?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/116068011307172554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=116068011307172554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116068011307172554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/116068011307172554'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/10/vim-cookbook-by-steve-oualline.html' title='Vim Cookbook by Steve Oualline'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115866064721134573</id><published>2006-09-19T03:10:00.000-07:00</published><updated>2006-09-19T03:10:47.223-07:00</updated><title type='text'>All about Linux: A visual walk through of a couple of the new features in Vim 7.0</title><content type='html'>&lt;a href="http://linuxhelp.blogspot.com/2006/09/visual-walk-through-of-couple-of-new.html"&gt;All about Linux: A visual walk through of a couple of the new features in Vim 7.0&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115866064721134573?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115866064721134573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115866064721134573' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115866064721134573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115866064721134573'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/09/all-about-linux-visual-walk-through-of.html' title='All about Linux: A visual walk through of a couple of the new features in Vim 7.0'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115833413795451180</id><published>2006-09-15T08:21:00.000-07:00</published><updated>2010-05-10T12:18:53.236-07:00</updated><title type='text'>VIM 7 :: RE: turn off paren/parenthesis/whatever highlighting</title><content type='html'>&lt;p&gt; The &lt;a href=http://vimrc-dissection.blogspot.com/2006/09/vim-7-turn-off-parenparenthesiswhateve.html&gt;&lt;i&gt;fix&lt;/i&gt;&lt;/a&gt; submitted before isn't reliable. That piece of magic in .vimrc does the job:&lt;br /&gt;&lt;p&gt; &lt;code&gt;let loaded_matchparen = 1&lt;/code&gt;&lt;br /&gt;&lt;p&gt; It tells some plug-in/script/whatever that it has already did the job. If you put that in &lt;code&gt;.vimrc&lt;/code&gt; - it would think that way always and would not load anymore. Nice.&lt;br /&gt;&lt;p&gt; P.S. The Tip was found here &lt;code&gt;:help pi_paren.txt&lt;/code&gt;. It would be all really nice if computers had a special interface to read my mind - and tell me how the devels named particular feature. That way I will not need to waste weeks to find the corresponding help entry.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115833413795451180?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115833413795451180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115833413795451180' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115833413795451180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115833413795451180'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/09/vim-7-re-turn-off-parenparenthesiswhat.html' title='VIM 7 :: RE: turn off paren/parenthesis/whatever highlighting'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>36</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115814203950892766</id><published>2006-09-13T02:59:00.000-07:00</published><updated>2006-09-13T03:07:19.560-07:00</updated><title type='text'>VIM7 :: file type detection</title><content type='html'>&lt;p&gt; New in VIM7 is file type detection. To get info whether it is present/activated try that:&lt;br /&gt;&lt;p&gt;&lt;code&gt;:filetype&lt;/code&gt;&lt;br /&gt;&lt;p&gt;and that to turn it off:&lt;br /&gt;&lt;p&gt;&lt;code&gt;:filetype off&lt;/code&gt;&lt;br /&gt;&lt;p&gt;File types are made to allow bulk customization for particular file type. At moment it doesn't provide any advantages over plain &lt;a href="http://vimrc-dissection.blogspot.com/2006/07/syntax-highlight-for-non-standard-file.html"&gt;&lt;code&gt;:au&lt;/code&gt;&lt;/a&gt; - but probably more to come in future.&lt;br /&gt;&lt;p&gt; P.S. &lt;code&gt;:filetype off&lt;/code&gt; must be at top of &lt;code&gt;.vimrc&lt;/code&gt; - it tries to manage everything so many options changed before would be reset.&lt;br /&gt;&lt;p&gt; P.P.S. Relevant help pages/see also: &lt;code&gt;:help filetype&lt;/code&gt;, &lt;code&gt;:help 'filetype'&lt;/code&gt; and &lt;code&gt;:help ftplugin&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115814203950892766?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115814203950892766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115814203950892766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115814203950892766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115814203950892766'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/09/vim7-file-type-detection.html' title='VIM7 :: file type detection'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115797691529707942</id><published>2006-09-11T05:02:00.000-07:00</published><updated>2006-09-15T08:30:57.240-07:00</updated><title type='text'>VIM 7 :: turn off paren/parenthesis/whatever highlighting</title><content type='html'>&lt;p&gt; Put that line into &lt;code&gt;.gvimrc&lt;/code&gt;:&lt;br /&gt;&lt;p&gt; &lt;code&gt;NoMatchParen&lt;/code&gt;&lt;br /&gt;&lt;p&gt; Seems like due to serious Q&amp;A problem that shit creeped into release of VIM7.&lt;br /&gt;&lt;p&gt; &lt;code&gt;:help hl-MatchParen&lt;/code&gt; for more info on how to wear down your eye in under 5 minutes with minimum of options set. [sarcasm off]&lt;br /&gt;&lt;p&gt; Edit1: seems like that &lt;i&gt;feature&lt;/i&gt; is automatically enabled only for GUI vim, in other words &lt;code&gt;NoMatchParen&lt;/code&gt; is accepted only in &lt;code&gt;.gvimrc&lt;/code&gt;.&lt;br /&gt;&lt;p&gt; Edit2: The solution is not reliable. &lt;a href=http://vimrc-dissection.blogspot.com/2006/09/vim-7-re-turn-off-parenparenthesiswhat.html&gt;Proper fix!&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115797691529707942?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115797691529707942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115797691529707942' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115797691529707942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115797691529707942'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/09/vim-7-turn-off-parenparenthesiswhateve.html' title='VIM 7 :: turn off paren/parenthesis/whatever highlighting'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115703084931445888</id><published>2006-08-31T06:15:00.000-07:00</published><updated>2006-08-31T06:27:33.406-07:00</updated><title type='text'>Dangers of Wikipedia</title><content type='html'>That damm Wikipedia thing is addictive. It must be outlawed. Once you start reading it - page after page, link after link - you cannot stop.&lt;br /&gt;&lt;br /&gt;Anyway. Pretty nice opinion from Tim O'Reilly about why he is &lt;a href="http://www.oreilly.com/pub/a/oreilly/ask_tim/1999/unix_editor.html"&gt;vi guy&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Replace "emacs" with "random Wind0ze GUI IDE" - and what he said would be true to me too.&lt;br /&gt;&lt;br /&gt;P.S. As for me, "Emacs vs. VI " holy war really comes down to "all-in-one v. modularized" debate. Or from another POV it can be seen as "shell vs. emacs lisp": to Emacs lisp is what shell to Unix. I like VIM since it works with shell directly - it does not have any layers distancing user from OS. I guess if one doesn't like shell but likes elisp instead - then Emacs may be the way to go.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115703084931445888?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115703084931445888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115703084931445888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115703084931445888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115703084931445888'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/dangers-of-wikipedia.html' title='Dangers of Wikipedia'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115702995487211370</id><published>2006-08-31T06:08:00.000-07:00</published><updated>2006-08-31T06:12:37.193-07:00</updated><title type='text'>Cult of vi</title><content type='html'>&lt;a href="http://www.splange.freeserve.co.uk/misc/vi.html"&gt;Cult of vi&lt;/a&gt; has among other interesting references the chart of &lt;a href="http://www.splange.freeserve.co.uk/viref.html"&gt;vi commands&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;P.S. &lt;code&gt;:g/^/m0/&lt;/code&gt; and &lt;code&gt;ZZ&lt;/code&gt; look like fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115702995487211370?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115702995487211370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115702995487211370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115702995487211370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115702995487211370'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/cult-of-vi.html' title='Cult of vi'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115702904370183144</id><published>2006-08-31T05:56:00.000-07:00</published><updated>2006-08-31T05:57:23.723-07:00</updated><title type='text'>VIM @ Wikipedia</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Vim_%28text_editor%29"&gt;VIM's Wikipedia Page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115702904370183144?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115702904370183144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115702904370183144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115702904370183144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115702904370183144'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/vim-wikipedia.html' title='VIM @ Wikipedia'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115701829070737736</id><published>2006-08-31T02:53:00.000-07:00</published><updated>2006-08-31T02:58:10.716-07:00</updated><title type='text'>Off-Topic: dumping gcc/cpp predefined macros</title><content type='html'>&lt;code&gt;echo | gcc -dM -E -&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;-dM&lt;/code&gt; tells &lt;code&gt;cpp&lt;/code&gt; to out &lt;code&gt;#define&lt;/code&gt; for every variable it has.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;-E&lt;/code&gt; tells &lt;code&gt;gcc&lt;/code&gt; to run &lt;code&gt;cpp&lt;/code&gt; only&lt;br /&gt;&lt;br /&gt;P.S. I dead tired to dig documentation every time I need to find how platform is identified by GCC. So putting that stuff here in hope that it would be easier locatable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115701829070737736?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115701829070737736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115701829070737736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115701829070737736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115701829070737736'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/off-topic-dumping-gcccpp-predefined.html' title='Off-Topic: dumping gcc/cpp predefined macros'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115555885558446958</id><published>2006-08-14T04:42:00.000-07:00</published><updated>2006-08-14T05:34:15.640-07:00</updated><title type='text'>vim :: repetition counter (and period command)</title><content type='html'>One of the funniest (and obscure) VIM features is repetition counter. Most of the commands allow the counter. Consider example (that needs to be typed in in normal mode):&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;20l&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;The VIM's command 'l' is the command to move left (VIM supports motion keys as in old time games - 'h', 'j', 'k' and 'l' are correspondently left, down, up and right.) Prepended to it '20' is the repetition counter. If cursor was in position 1, after the command it would be in position 21 (or on end of line if it is shorter).&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;1000dd&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;Would delete 1000 lines starting from current.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;3f&amp;lt;Space&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;Would move cursor to third space in line, counting from current cursor position. (&lt;code&gt;:help f&lt;/code&gt; for find motion command.)&lt;br /&gt;&lt;br /&gt;It is very useful at times for example combined with command '.' which is used to repeat last command(s). Example how to make a nice C comment with 50 dashes.&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&amp;lt;Insert&gt;/*&amp;lt;Space&gt;&amp;lt;Space&gt;*/&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;Esc&gt;lll&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;Insert&gt;-&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;Esc&gt;49.&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;I intentionally made typing of dash separate, thus it can be later repeated with '.' command. I yet to gain complete understanding on how '.' works precisely, but in most obvious cases it works as expected. &lt;code&gt;:help .&lt;/code&gt; for more info. Experimentation plus 'u' undo command could help to get it right.&lt;br /&gt;&lt;br /&gt;More info can be found in VIM under &lt;code&gt;:help count&lt;/code&gt; &amp;amp; &lt;code&gt;:help repeat.txt&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115555885558446958?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115555885558446958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115555885558446958' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115555885558446958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115555885558446958'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/vim-repetition-counter-and-period.html' title='vim :: repetition counter (and period command)'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115533500048568132</id><published>2006-08-11T14:54:00.000-07:00</published><updated>2006-08-11T15:34:26.480-07:00</updated><title type='text'>vertical selection from Nth to Mth character</title><content type='html'>ZOMG! I got e-mail. That stuff apparently got indexed by Google. So. Here we go.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"&gt;I do have a question for you, however.  When performing a vertical selection, is there any way to advance the screen other than the arrow keys? For instance, if a file were thousands of lines long, is there a way to quickly select characters 10 through 20 for the entire length?&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;All motion shortcuts must work as usual. (&lt;code&gt;:help motion.txt&lt;/code&gt;) In other words. To select vertically across all lines in the file chars 10 to 20 you need something like that (those " are comments):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;gg      " move to beginning of file, beginning of line&lt;br /&gt;9l      " move to 10th symbol in line (l == move 1 char left, &lt;br /&gt;        "   9l == move 9 times chars left)&lt;br /&gt;^V      " start vertical selection&lt;br /&gt;G       " move to last line of file, beginning of line&lt;br /&gt;19l     " move to 20th symbol in line.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;now y/d/whatever to yank/delete/etc. IOW, no magic - standard shortcuts. I hope that answers your question.&lt;br /&gt;&lt;br /&gt;Though there might be problem: if last line of file shorter than 20 characters, or if first line shorter than 10 characters, or tab character is sitting somewhere there - VIM wouldn't be able to do precisely what you want it to do. &lt;br /&gt;&lt;br /&gt;P.S. For later case shell comes in handy: &lt;code&gt;man cut&lt;/code&gt; for -b &amp;amp; -c options. Using redirection and intermediate file you can get you part into separate file and then open it (along with original) in VIM - and use normal line blocks. With combination of head and tail (&lt;code&gt;man head&lt;/code&gt; &amp;amp; &lt;code&gt;man tail&lt;/code&gt;) you can get from file lines you need.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115533500048568132?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115533500048568132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115533500048568132' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115533500048568132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115533500048568132'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/vertical-selection-from-nth-to-mth.html' title='vertical selection from Nth to Mth character'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115521703620480279</id><published>2006-08-10T06:17:00.000-07:00</published><updated>2008-02-01T03:03:01.911-08:00</updated><title type='text'>vim :: turn that 'showmatch' crap off</title><content type='html'>I have just waisted hour to find that sucker:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;set noshowmatch&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;SUSE (as well RedHat) have long tradition of shipping f*cked up configs for all major editors and terminal emulators. SUSE 10 (in addition to unusable xterm config and vim's "set backspace=0" (which renders backspace key in vim totally borken)) now started adding "set showmatch" to default exrc. As if anybody over there at SUSE/Novell actually used once xterm or vim. Why they keep crapping in the configs?? Are GNOME/KDE configs not enough for distros to shit into???&lt;br /&gt;&lt;br /&gt;&lt;code&gt;set showmatch&lt;/code&gt;, if you have just typed parens/bracket/comment opening/etc, makes cursor to jump shortly to its counterpart. That shit is creping off Wind0ze over-bloated unusable IDEs. It distracts your attention of what you were doing. It forces you to move your eye - as if you do not know your own source code - needlessly, wearing and tiring them down. Might it be OS vendors have a secret contract with ophthalmologists??? I have no other guess.&lt;br /&gt;&lt;br /&gt;P.S. Linux Productivity Magazine, Volume 1 Issue 5, December 2002 "VI and Vim" - &lt;a href="http://www.troubleshooters.com/lpm/200212/200212.htm"&gt;http://www.troubleshooters.com/lpm/200212/200212.htm&lt;/a&gt; - lots of vi/vim basics.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Edit1&lt;/b&gt; Related: &lt;a href="http://vimrc-dissection.blogspot.com/2006/09/vim-7-re-turn-off-parenparenthesiswhat.html"&gt;matching parens highlighting.&lt;/a&gt; Mistakenly attributed to VIM7, but also present in VIM6.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Edit2&lt;/b&gt; &lt;a href="http://vimrc-dissection.blogspot.com/2006/09/vim-7-re-turn-off-parenparenthesiswhat.html"&gt;Proper fix&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115521703620480279?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115521703620480279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115521703620480279' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115521703620480279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115521703620480279'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/08/vim-turn-that-showmatch-crap.html' title='vim :: turn that &apos;showmatch&apos; crap off'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115322805314802202</id><published>2006-07-18T05:42:00.000-07:00</published><updated>2006-07-18T06:07:33.233-07:00</updated><title type='text'>vim :: tags keyboard shortcuts</title><content type='html'>Keyboard shortcuts used to work with tags. There are really few of them. All of them work in control/normal mode.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;:set tags?&lt;/code&gt; needless to remind that VIM must be told which tag files to use. It can be done automatically as for example shown &lt;a href="http://vimrc-dissection.blogspot.com/2006/05/making-vim-and-ctags-real-friends.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tag word&lt;/code&gt; is main one. Opens file and goes to line with first tag entry matching word.&lt;/li&gt;&lt;li&gt;^] same as above, but uses word under cursor.&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tag /word&lt;/code&gt; is similar to &lt;code&gt;:tag word&lt;/code&gt;. Opens file and goes to line with first tag entry matching regular expression in word.&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tselect word&lt;/code&gt; is what I use most often. The function - tag select - displays list of matching tags allowing you to select one to go to. Without word, it will display list of matching tags for word used last time.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;g^]&lt;/code&gt; same as above, but uses word under cursor. Also, omits displaying list if only single match is found.&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tnext&lt;/code&gt; goes to next matching tag entry.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tprev&lt;/code&gt; goes to previous matching tag entry.&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tlast&lt;/code&gt; goes to last matching tag entry.&lt;/li&gt;&lt;li&gt;&lt;code&gt;:tfirst&lt;/code&gt; goes to first matching tag entry.&lt;/li&gt;&lt;li&gt;&lt;code&gt;^T&lt;/code&gt; Every time you do &lt;code&gt;:tag word&lt;/code&gt;, the word with current file position is put on stack and vim goes to new file/position as it is told by tag file. To restore the previous file position you use &lt;code&gt;^T&lt;/code&gt;. The shortcut removes tag stack top element and moves to the file position saved there. So if you wandered off far away with &lt;code&gt;^]&lt;/code&gt; - to return back where you started you need to press &lt;code&gt;^T&lt;/code&gt; until vim would complain that it is at bottom of tag stack.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;That's about it. Both &lt;code&gt;:tag word&lt;/code&gt; and &lt;code&gt;:tselect word&lt;/code&gt; support wildcard key (Tab/^D) to show list of tags matching partially the word. That will work with regilar expressions too. But be warned that often tag files can host millions of entries: displaying list of thousands items can take some time. Use wildcard key carefully.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115322805314802202?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115322805314802202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115322805314802202' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115322805314802202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115322805314802202'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/07/vim-tags-keyboard-shortcuts.html' title='vim :: tags keyboard shortcuts'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115294652500042025</id><published>2006-07-14T23:40:00.000-07:00</published><updated>2006-07-14T23:55:25.056-07:00</updated><title type='text'>syntax highlight for non-standard file types</title><content type='html'>Following line once put into vimrc will tell vim which syntax highlighting to use:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;au BufReadPost SCons* set syntax=python&lt;br /&gt;au BufReadPost Cons* set syntax=perl&lt;br /&gt;au BufReadPost *.mke set syntax=make&lt;br /&gt;au BufReadPost make*.inc set syntax=make&lt;br /&gt;au BufReadPost *.fcc set syntax=cpp&lt;br /&gt;au BufReadPost *.fhh set syntax=cpp&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This is selfexplanatory. e.g. SCons files are in fact python scripts - so tell vim to use python syntax highlighting on everything what matches 'SCons*'. Same goes for Construct - but done in perl.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;:au BufReadPost &amp;lt;mask&amp;gt;&lt;/code&gt; tells vim to execute something right after file read into buffer. In that particular case we use that to set buffer local variable 'syntax' to name of one of standard syntax highlightings (perl, make, cpp, etc). &lt;code&gt;:help :au&lt;/code&gt; for more info.&lt;br /&gt;&lt;br /&gt;P.S. One can check what syntax module vim has loaded by looking at 'syntax' variable value: do &lt;code&gt;:set syntax?&lt;/code&gt; after opening file recognized by vim.&lt;br /&gt;&lt;br /&gt;P.P.S. Of course, &lt;code&gt;:syntax on&lt;/code&gt; has to be put somewhere in the vimrc for syntax highlighting to work automatically. VIM 6.x doesn't have problem of previous versions (I experienced that in VIM 5.x), where loading of syntax from vimrc was slowing launch time, even if file had no syntax highlighting assigned. Hm.. or probably my PC now fast enough for me not to notice that launch time. Who cares. It works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115294652500042025?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115294652500042025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115294652500042025' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115294652500042025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115294652500042025'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/07/syntax-highlight-for-non-standard-file.html' title='syntax highlight for non-standard file types'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115167729491252440</id><published>2006-06-30T07:11:00.000-07:00</published><updated>2006-06-30T08:17:23.656-07:00</updated><title type='text'>highligting tabs and trailing spaces</title><content type='html'>Add the following to .vimrc:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;highlight SpecialKey ctermfg=DarkGray&lt;br /&gt;set listchars=tab:»-,trail:~&lt;br /&gt;set list&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That makes something like that:&lt;br /&gt;&lt;pre&gt;map &amp;lt;silent&gt; &amp;lt;F7&gt; :exec ":e ".(expand("%") =~ ".h$"&lt;br /&gt;       \       ? glob(substitute(expand("%"), ".h$", ".cpp", ""))&lt;br /&gt;       \       : substitute(expand("%"), "\\.cpp$", ".h", ""));&amp;lt;CR&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;to be displayed that way:&lt;br /&gt;&lt;pre&gt;map &amp;lt;silent&gt; &amp;lt;F7&gt; :exec ":e ".(expand("%") =~ ".h$"~&lt;br /&gt;»-------\»------? glob(substitute(expand("%"), ".h$", ".cpp", ""))&lt;br /&gt;»-------\»------: substitute(expand("%"), "\\.cpp$", ".h", ""))&amp;lt;CR&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Tabs are now plainly visible and also public enemy trailing space on first line became apparent.&lt;br /&gt;&lt;br /&gt;P.S. Nice character '»' requires &lt;code&gt;set encoding=utf-8&lt;/code&gt;. That looks great with "Andale Mono" and "Black Bold" color set in PuTTY to (39,39,39).&lt;br /&gt;&lt;br /&gt;Edit1:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5536/692/1600/vim-with-nolist.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5536/692/320/vim-with-nolist.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;to&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5536/692/1600/vim-with-list.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5536/692/320/vim-with-list.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115167729491252440?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115167729491252440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115167729491252440' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115167729491252440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115167729491252440'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/06/highligting-tabs-and-trailing-spaces.html' title='highligting tabs and trailing spaces'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115167494992572210</id><published>2006-06-30T06:38:00.000-07:00</published><updated>2006-06-30T06:42:29.936-07:00</updated><title type='text'>tabs!!!</title><content type='html'>It's nice to know that there are reasonable people left. Read on.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://derkarl.org/why_to_tabs.html"&gt;http://derkarl.org/why_to_tabs.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Attack of clowns^Wclones^Wamateurs of WYSIWYG/WYSIAYG at times is plain depressing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115167494992572210?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115167494992572210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115167494992572210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115167494992572210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115167494992572210'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/06/tabs.html' title='tabs!!!'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28654195.post-115151051981247554</id><published>2006-06-28T08:44:00.000-07:00</published><updated>2006-06-28T09:01:59.860-07:00</updated><title type='text'>vim :: windows and buffers</title><content type='html'>VIM can  open and edit simultaneously many files. For that VIM uses two elements:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Window&lt;/span&gt; - part of VIM's screen space. Screen of every VIM instance can be divided into several windows. When GUI available, one can of course launch several instances of VIM. But in terminal in common case user is limited to single 80x25. When you need to edit two files side by side - VIM windows come to help.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Buffer&lt;/span&gt; - place in VIM's memory. That's where file content resides while you are editing it. Buffers is what you see in output of ":ls" command. Every file you open automatically put into new buffer. Buffers are numbered starting from 1. Single buffer can be displayed in more than one window at the same time.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Consult ":help windows" (":help buffers") for indepth info on buffers and windows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28654195-115151051981247554?l=vimrc-dissection.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vimrc-dissection.blogspot.com/feeds/115151051981247554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=28654195&amp;postID=115151051981247554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115151051981247554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28654195/posts/default/115151051981247554'/><link rel='alternate' type='text/html' href='http://vimrc-dissection.blogspot.com/2006/06/vim-windows-and-buffers.html' title='vim :: windows and buffers'/><author><name>Ihar Filipau</name><uri>http://www.blogger.com/profile/05086565400407007423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='19' src='http://photos1.blogger.com/blogger/5536/692/1600/white-rat-front-side.gif'/></author><thr:total>0</thr:total></entry></feed>
