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

<channel>
	<title>Vladimir Cvetic &#187; Thinking out loud</title>
	<atom:link href="http://www.hazaah.com/cat/something-else/thinking-out-loud/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hazaah.com</link>
	<description>buffle the world</description>
	<lastBuildDate>Thu, 12 Nov 2009 14:30:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TextMate and Vim</title>
		<link>http://www.hazaah.com/programming/textmate-and-vim/</link>
		<comments>http://www.hazaah.com/programming/textmate-and-vim/#comments</comments>
		<pubDate>Mon, 29 Jan 2007 14:41:03 +0000</pubDate>
		<dc:creator>Vladimir Cvetic</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Something Else]]></category>
		<category><![CDATA[Thinking out loud]]></category>

		<guid isPermaLink="false">http://www.knowbies.com/vladimir-cvetic/programming/textmate-and-vim/</guid>
		<description><![CDATA[Without doubt, theyâ€™re both great editors.  Which one should you be using? Thatâ€™s a personal decision.
Look and feel
This is a personal decision.  But most people seem to prefer how TextMate looks on Mac OSX over how Vim looks.  I agree with them.  TextMate looks like an actual Cocoa app (because it [...]]]></description>
			<content:encoded><![CDATA[<p>Without doubt, theyâ€™re both great editors.  Which one should you be using? Thatâ€™s a <em>personal</em> decision.</p>
<h2>Look and feel</h2>
<p>This is a <em>personal</em> decision.  But most people seem to prefer how TextMate looks on Mac <span class="caps">OSX</span> over how Vim looks.  I agree with them.  TextMate looks like an actual Cocoa app (because it is!).</p>
<p>Want to compare?  Check out the picture at the top.</p>
<p>I feel like the tabs for GVim is tacked on (for OS X) and the overall layout isnâ€™t nice as TextMateâ€™s. But if aesthetics were everything, I wouldnâ€™t be using GVim on an Apple.</p>
<h2>Moving the cursor around</h2>
<p>Moving around is important while editing. You should be able to move to the beginning/end of a line/sentence/paragraph with one or two keystrokes.</p>
<h3>Basic navigation (up/down/left/right â€“ by units/words/sentences/paragraphs)</h3>
<p>TextMate uses Emacs keybindings for navigation, much like other Cocoa applications. ^N, ^P moves to the next and previous line. ^F, ^B moves forwards and backwards. Alt-F, Alt-B moves forwards and backwards by words. Thereâ€™s also Alt-Up/Down/Left/Right. This defaults to movement by paragraphs/words. Lastly, thereâ€™s Command-Up/Down/Left/Right, which moves to the beginning/end of the document or line (^A and ^E also work for the beginning/end of the line).</p>
<p>You can extend TextMateâ€™s navigation either by <a href="http://t0fuu.wordpress.com/2006/08/30/keybindings/">setting your keybindings</a> or by using the TextMate bundle editor.</p>
<p>What about Vim? Navigation is already there. In command mode, h,j,k,l moves in all four directions. 0, ^, $ moves the cursor to the beginning/first char/end of the line. (,),{,} moves to beginning/end of sentence/paragraph. And to move by units of words, you have b,B,w,W,e,E.</p>
<h3>Movement by search</h3>
<p>My favorite part is navigation by searching for both editors. For TextMate, you can search by hitting ^S. For Vim, /regexp or fx, Fx, tx, and Tx (search by character).</p>
<p>TextMate has something awesome, Shift-Apple-T â€“ search by symbols. This searches special keywords within a file. So for Ruby, it searches class/method definitions only.</p>
<p>Shift-Apple-T and enter â€œinitializeâ€ will look for the line â€œdef initializeâ€.</p>
<p>Whatâ€™s great about it though, itâ€™s for <em>all</em> languages, no customization needed. For Vim, you could easily extend the editor to have ^T to look for a method definition, but you would have to define it for each language.</p>
<pre>nmap <C-T> /^ *def</pre>
<h3>Movement by line numbers</h3>
<p>To go to line 24 in Vim, thereâ€™s 24G.  For TextMate, Apple-L 24.  Not much difference.</p>
<h2>Navigating through files</h2>
<p>A new Rails application generates over 40 files in many different directories. You <em>need</em> good file navigation. You donâ€™t want to be typing the same directory path over and over again, and you donâ€™t want to have to use a mouse to open up a file for editing.</p>
<p>This is where TextMate is awesome. When you open TextMate, you can specify a directory. This directory becomes your project. Any files underneath this directory, any level deep (think **), can be quickly accessed within TextMate. You just hit Apple-T and type in the filename. You donâ€™t even need the entire filename, just bits and pieces of it.</p>
<p>Hereâ€™s an example:</p>
<ol>
<li>You open the directory â€˜root/â€™.</li>
<li>You want to open the file â€˜root/app/controllers/wiki_controller.rbâ€™.</li>
<li>Hit Apple-T and type wiki.  This matches wiki_controller.rb.</li>
<li>Hit enter, and you have the new file.</li>
</ol>
<p>Really eloquent.</p>
<p>For Vim, there are multiple ways to navigate through files. Most of them, though, youâ€™ll have to specify the entire path. After using TextMate, I tried to emulate Apple-T in Vim.</p>
<pre><strong>
nmap <D-T> :e **/
</strong></pre>
<p><strong>        </strong>This sort of comes close, although not as clean. Basically, just hit Apple-T and youâ€™ll get â€™:e **/â€™ on the ex command. Now you can enter in a filename within any directory underneath the current directory.</p>
<p>Another way would be by setting up your path.  Inside your .vimrc, just use:</p>
<pre>set path+=**</pre>
<p>Now inside your editor, use:</p>
<pre>:find filename</pre>
<p>Both :e **/ and :find work, but itâ€™s not as short and sweet as TextMate.</p>
<h2>Tabs vs Buffers vs Windows</h2>
<p>When you open multiple files for editing, you get tabs in TextMate.  For Vim, you can have tabs and/or buffers.</p>
<p>Buffers are pretty handy in Vim.  Say you open up a file and close it.  When you want to re-open it.  Just do this:</p>
<pre>:b part-of-file-name</pre>
<p>And that will re-open it for you.  You can even check what files are currently open:</p>
<pre>:buffers</pre>
<p>What I find really useful though, is Vimâ€™s window system. You can open up multiple editing windows within the same tab. Pretty neat, especially if you want to view one file while editing another (I use it to look at my unit tests while editing library files). To use the window system,</p>
<pre>:split
:vsplit</pre>
<p>split will split horizontally, vsplit will split vertically.  To switch between windows, use ^W^W.</p>
<h2>Highlighting text</h2>
<p>Is highlighting text important?  Yeah!  You highlight text to perform a command on it or to move it around.</p>
<p>For TextMate, you can highlight text by holding down Shift and using any movement keys. To highlight a line, Shift-Apple-L. After you highlight some text, you can perform an action on it, like cut, copy, delete.</p>
<p>Basically though, you can highlight a character, line, or block with v, V, ^V. After you highlight it, use any movements to highlight more. You can use basic movement keys or movement by searches. After you highlight, you can delete, yank, search/replace, or do any commands.</p>
<h2>Search and Replace</h2>
<p>Speaking of search/replace, letâ€™s see how both editors implement this feature.</p>
<p>TextMate has Apple-F, which has the option to use regular expressions or not. This is simple and very easy to use.</p>
<p>Vim has :%s/search_term/replace_term/g. Pretty confusing for a newcomer, but after you get used to it, itâ€™s pretty simple to use. Except for regular expressions, where youâ€™ll get a lot of \ escape characters. It looks ugly sometimes, but can be done quickly and succinctly.</p>
<p>Both allow for confirmation when replacing â€“ for Vim %s/search/replace/gc, for TextMate itâ€™s an option you set.</p>
<p>I have to hand it to TextMate though, search and replace in the <em>entire</em> project is a great feature.  This lets you replace words recursively, throughout the entire project.</p>
<h2>Copy/Yanking and Pasting</h2>
<p>Why is copying/pasting important? After all there is an anti-pattern in programming called copy/pasting programming. Well, itâ€™s useful for refactoring. There are plenty of times when you want to extract a piece of code. Without any refactoring tools, cutting and pasting is your best friend.</p>
<p>For Vim, thereâ€™s a lot. y is for yanking, and you can use it with a movement command to select how much to yank (or with visual mode). Later you can paste it with p/P (before or after current line or character). You can remember up to the last 9 yanks with â€œ1-9 (thatâ€™s â€œ1 or â€œ2 or â€œ3â€¦). If you want to paste the latest yank, â€œ1p. For the second latest, â€œ2p. If youâ€™re ever unsure, just use the command:</p>
<pre>:reg</pre>
<p>TextMate has the basic Apple-C, Apple-X, Apple-V for copying and pasting. Thereâ€™s also ^-Alt-Apple-V for remember a list of recently copied items for pasting (this is extremely intuitive, you donâ€™t have to remember which register you saved it in like in Vim). Hitting ^-Alt-Apple-V will list out all of your recently copied items that you can choose from (called Paste from History).</p>
<h2>Completion, Omnicompletion, and Documentation Lookup</h2>
<p>Sometimes, youâ€™ll type a long word like supercalifragiliciousexpialidocious (spelling??). You donâ€™t want to type that over and over again. Completion to the rescue.</p>
<p>For TextMate, just type part of the word â€“ super â€“ and then hit .  This will complete the entire word, very simple.</p>
<p>For Vim, ^x^p will look previous to the current cursor position for the complete word. ^x^n will look below the current cursor position for the complete word. So if Iâ€™m below the entire word and type â€“ super â€“ I would use ^x^p.</p>
<p>But Vim 7.0 has a new feature, omni-completion. This is like smart completion based on the current language and context. For example, if Iâ€™m in a ruby file and I type:</p>
<pre>String.</pre>
<p>And hit ^x^o, a list of possible method names will pop up that I can choose from. The list will have all valid class methods of String.</p>
<p>TextMate doesnâ€™t have omnicompletion, but there is something just as useful. Internal documentation! After typing String, I can hit ^H, which will look for the documentation on String. This is extremely useful when learning a new language.</p>
<h2>Snippets and abbreviations</h2>
<p>Snippets in TextMate are great.  Basically, you define a snippet like this:</p>
<pre>def ${1:method_name}
end</pre>
<p>Now if you type â€˜defâ€™ and hit tab, it will expand to:</p>
<pre>def method_name
end</pre>
<p>method_name will be highlighted and ready to replace. If there were more than one items to replace, you could keep on hitting to jump to each item. Itâ€™s a great productivity gain.</p>
<p>For Vim, there are a couple of scripts that try to emulate snippets.  But natively, thereâ€™s abbreviations.  For example:</p>
<pre>iab def def<CR>end<Esc>-A</pre>
<p>Now if you type â€˜defâ€™ and hit your spacebar, itâ€™ll become:</p>
<pre>def
end</pre>
<p>With the cursor right after â€˜defâ€™.  Thereâ€™s no jumping around different items like TextMateâ€™s snippets.</p>
<h2>Integration with Unit Tests, compilers, etc.</h2>
<p>Ever run a compiler that spit out errors and their line numbers? Didnâ€™t you wish that your editor could just jump to those line numbers?</p>
<p>Well with Vim you can!  You can compile code within the editor:</p>
<pre>:make</pre>
<p>Which will run your Makefile.  Any errors will go into a â€˜quick listâ€™.  To use a quicklist:</p>
<pre>:clist
:cnext
:cprev</pre>
<p>These commands will jump to the next/previous error or list out all of your errors. The shortcut to these commands or :cl, :cn, and :cp.</p>
<p>But what about languages that arenâ€™t C, C++, or Java?  Well, you have to customize it.  Iâ€™m not sure about <span class="caps">PHP</span> or Python, but for Ruby thereâ€™s the ruby-vim gem.  Check out instructions on how to install it <a href="http://t0fuu.wordpress.com/2006/09/11/using-vim-for-editing-ruby/">here</a>.</p>
<p>Once you install the gem, you have to manually set â€˜makeprgâ€™ while youâ€™re editing.</p>
<pre>:set makeprg=ruby -w</pre>
<p>This will set your compiler to the ruby interpreter with warnings.  Now in your editor, run :make , ( means replace with this filename).  Any errors will populate your quicklist and you can jump to each error with :cn or :cp.</p>
<p>Whatâ€™s amazing though is the vim-rubyâ€™s integration with unit tests. Instead of running the file through the ruby interpreter, you can run your unit tests. Any errors will populate your quicklist (this assumes you have a Rakefile). To do this:</p>
<pre>:source /path/to/vim/config/compiler/rubyunit.vim
:set makeprg=rake test</pre>
<p>Now run:</p>
<pre>:make</pre>
<p>Vim will jump to the first error produced by your unit tests.  To go to the next error, just use :cn or :cp.</p>
<p>Unfortunately, there are still some bugs with it. The first error is usually fine to jump to but next errors sometimes end up jumping to a blank file. Either that, or Iâ€™m using it wrongâ€¦</p>
<p>As for TextMate, hitting Apple-R will run the current file. So if the file is a unit test, that unit test will be executed. To run a focused unit test for Ruby, just put the cursor in a test definition and use Shift-Apple-R.</p>
<p>Update:<br />
I just found out that TextMate has great integration with Rubyâ€™s unit testing facility. If youâ€™re currently editing a unit test file, you can hit Apple-R to run it in RubyMate. A new window will pop up, and if there are any errors, the stack traces will have links to the file/position. So you can just click on it and TextMate will open that file to the exact position of the error, pretty awesome.</p>
<h2>What I missed</h2>
<p>What was mentioned in this article was just some features I could think of off the top of my head.  I missed a <em>lot</em> of features for both editors.</p>
<p>For TextMate, thereâ€™s macros, bookmarking, folding. For Vim, thereâ€™s recording, marks, and more folding. Thereâ€™s a lot more too, like extending the editors for new languages â€“ syntax highlighting, colorschemes, etc.</p>
<p>Try them out for yourself.  Get a TextMate trial at <a href="http://macromates.com/">macromates</a>.  Compare the two editors to see which you like best.  After all, choosing an editor is a <em>personal</em> decision, everyoneâ€™s favorite editor is going to be different.</p>
<p>Donâ€™t forget to learn more about your editor <em>everyday</em>. Try learning new ways to search/replace or better ways for movement. Try extending your editor with macros or scripts. Since it is a <em>personal</em> decision, itâ€™s a good idea to customize your editor.</p>
<p>Update: Sorry for any errors in regards to keyboard instructions.  I wrote this post with Textile and forgot that ^carets^ handles superscript.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hazaah.com/programming/textmate-and-vim/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Wordpress MU1.0 Good or Bad thing?</title>
		<link>http://www.hazaah.com/something-else/wordpress-mu10-good-or-bad-thing/</link>
		<comments>http://www.hazaah.com/something-else/wordpress-mu10-good-or-bad-thing/#comments</comments>
		<pubDate>Sat, 25 Nov 2006 14:09:17 +0000</pubDate>
		<dc:creator>Vladimir Cvetic</dc:creator>
				<category><![CDATA[Something Else]]></category>
		<category><![CDATA[Thinking out loud]]></category>

		<guid isPermaLink="false">http://www.knowbies.com/vladimir-cvetic/something-else/wordpress-mu10-good-or-bad-thing/</guid>
		<description><![CDATA[If you didn&#8217;t know about 30 days ago Wordpress Team released Multi User version of their popular Blogging software, Wordpress MU.
Today I got my self thinking of starting my own blogging community based on this software and then it hit me! if I am thinking that so will thousends of other people around the net. [...]]]></description>
			<content:encoded><![CDATA[<p>If you didn&#8217;t know about 30 days ago Wordpress Team released Multi User version of their popular Blogging software, <a target="_blank" href="http://mu.wordpress.org/">Wordpress MU</a>.</p>
<p>Today I got my self thinking of starting my own blogging community based on this software and then it hit me! if I am thinking that so will thousends of other people around the net. I slapped myself and started thinking about the future of blogging communities&#8230; Call me paranoid but I think release of free publicly available Blogging Community software will dramaticly reduce general quality.</p>
<p>From the top of my mind I can think of several down sides of this:</p>
<ol>
<li>Dramatic quality reduction</li>
<li>Dramatic spam growth</li>
<li>Security</li>
<li>Possible SE penalties for decent bloggers</li>
</ol>
<p>and only two good things: More Competition and Comfort for those who need multi blogs out of the box (large companies for example).<br />
First good thing is somewhat inaccurate since we have so many of Free blogging communities.</p>
<p>In rest of this article I will focus on downsides and elaborate a bit more on them.</p>
<p>Spam growth and quality reduction are very closely tied. We are all aware of Adsense blog, this type of software will help these kind of bloggers to gain much more power of spam blog posts. Recently on Digg you could all see worpress plugin called &#8220;Digg Dugg&#8221; (there are tons of similar content ripping plugins), now imagine what would happen if spammers integrate this plugin (or something similar) to Wordpress MU. I agree that it was possible to generate large amount of spam blogs and rip content before but now! now it&#8217;s Free and widely available.</p>
<p>Based on this Google, Yahoo and others will probably need to organize better defence against this kind of spam. This could lead to SERP penalties for some or few decent bloggers.</p>
<p>Final thing is Security. Right now we have large amount of Blogging communities with good (mostly) in-house software solutions. In-house solutions give way more guarantee for users private data security. With release of Free and Widely available software members of these communities will face a problem. Owners will mostly be people who just installed and redesigned it and don&#8217;t have any clue about what the heck is inside the box they just opened.</p>
<p>I would really like to hear your opinions on this topic. So Good or Bad and why?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hazaah.com/something-else/wordpress-mu10-good-or-bad-thing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
