<?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>Tudor Barbu&#039;s professional blog &#187; vim</title>
	<atom:link href="http://blog.motane.lu/tag/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.motane.lu</link>
	<description>Ramblings about software development</description>
	<lastBuildDate>Thu, 02 Feb 2012 17:38:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>NERD_Tree &amp; Ack</title>
		<link>http://blog.motane.lu/2010/12/10/nerd_tree-ack/</link>
		<comments>http://blog.motane.lu/2010/12/10/nerd_tree-ack/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 18:12:02 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ack]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1433</guid>
		<description><![CDATA[I started using ack some time ago and I can say it&#8217;s much better than grep. Faster, more intuitive, much, much faster And I wanted to integrated with my vim environment. I use NERD_Tree and I couldn&#8217;t find any suitable module that will add ack functionality to it, so I decided to write my own. [...]]]></description>
			<content:encoded><![CDATA[<p>I started using ack some time ago and I can say it&#8217;s much better than grep. Faster, more intuitive, much, much faster <img src='http://blog.motane.lu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And I wanted to integrated with my vim environment. I use NERD_Tree and I couldn&#8217;t find any suitable module that will add ack functionality to it, so I decided to write my own. So, voila, my <a href="http://www.vim.org/scripts/script.php?script_id=3357" class="outgoing" title="NERD_Tree_Ack plugin">first vim plugin</a>.</p>
<h2><span>Installation:</span></h2>
<p>Install NERD_Tree first. Then download this module to ~/.vim/plugin/ or the appropriate location on your system and&#8230;you&#8217;re done. </p>
<p>Install ack (see details at <a href="http://betterthangrep.com" title="ack homepage" class="outgoing">betterthangrep.com</a> ). Depending on your operating system, you need to type something like &#8220;<em>sudo apt-get install ack-grep</em>&#8220;, &#8220;<em>brew install ack</em>&#8221; or other. Most of the installers will add ack to your $PATH, so NERD_Tree_Ack.vim won&#8217;t require additional configuration. If you&#8217;re weird and don&#8217;t want to add ack to your $PATH, just add the following line to your .vimrc file: </p>
<pre class="brush: plain; title: ; notranslate">
let g:path_to_search_app = &quot;/full/path/to/ack&quot;
</pre>
<h2><span>Using it</span></h2>
<p>Open NERD_Tree and point it to your project folder, by typing <em>:NERDtree /path/to/project</em> or by using bookmarks. Place the cursor on a folder and type the letter <em>m</em>. In the menu that will pop up you will have the option &#8220;(s)earch directory&#8221;. Select it by pressing <em>s</em> and type your pattern. If your search will yield results, you will see a window in the lower part of your screen, with all the results. Navigate with the keys and press <CR> to jump to a result. The file will be opened in the last working window.</p>
<p>Don&#8217;t forget to rate it if you like it <img src='http://blog.motane.lu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2010/12/10/nerd_tree-ack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Vim configuration</title>
		<link>http://blog.motane.lu/2010/01/26/my-vim-configuration/</link>
		<comments>http://blog.motane.lu/2010/01/26/my-vim-configuration/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 21:55:28 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[efficiency]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1293</guid>
		<description><![CDATA[Vim is the editor of the Gods. The Elder Gods. It&#8217;s by far the best text editor I&#8217;ve ever encountered. Although I&#8217;m not a &#8220;vim purist&#8221; (no hjkl ), I&#8217;m fascinated with its power. And there are always new things one can learn about it. It never gets old. For instance, today the head of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.motane.lu/wp-content/uploads/2010/01/vim-editor_logo-150x150.png" alt="" title="vim-editor_logo" width="150" height="150" class="alignleft size-thumbnail wp-image-1294" />Vim is the editor of the Gods. The Elder Gods. It&#8217;s by far the best text editor I&#8217;ve ever encountered. Although I&#8217;m not a &#8220;vim purist&#8221; (no hjkl <img src='http://blog.motane.lu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ), I&#8217;m fascinated with its power. And there are always new things one can learn about it. It never gets old.</p>
<p>For instance, today the head of my company&#8217;s IT department showed me the following cool trick: if you have an XML file loaded in a buffer and you want to have it properly indented, you just hit Escape in your Vim editor and type</p>
<pre class="brush: plain; title: ; notranslate">
:% !xmllint --format %
</pre>
<p>&#8230; and&#8230;Magic!</p>
<p>Anyway, lately I&#8217;ve spent some time puting together a list of very useful plugins for PHP/Zend Framework and python/django development in order to speed things up and become more productive. My (g)Vim configuration currently uses: </p>
<ul>
<li><a href="http://robrobbins.info/?page_id=2" title="Vilight colorscheme">Vilight colorscheme</a> by Rob Robbins</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=2540" title="snipMate">snipMate</a> by Michael Sanders</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1658" title="NERD_Tree">NERD_Tree</a> by Martin Grenfell</li>
<li><a href="http://github.com/robhudson/snipmate_for_django" title="django snippets">django snippets</a> by Rob Hudson</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1879" title="AutoComplPop">AutoComplPop</a> by Takeshi Nishida</li>
</ul>
<p>And a custom gvimrc file. If you want to give it a try, check out my GitHub repository at <a href="http://github.com/motanelu/GVim-configuration" title="Repository with my Gvim configuration">http://github.com/motanelu/GVim-configuration</a>. Installation is very simple, just follow the instructions below (PS: I&#8217;m using GVim. If you&#8217;re using Vim replace <em>gvimrc</em> with <em>vimrc</em>):</p>
<pre class="brush: plain; title: ; notranslate">
cd ~/
mv .vim .vim.bak
mv .gvimrc .gvimrc.bak
git clone git://github.com/motanelu/GVim-configuration.git
mv GVim-configuration .vim
ln -s ~/.vim/gvimrc ~/.gvimrc
</pre>
<p>Post a comment and tell me if you find it useful. If you&#8217;re a Zend Framework user, have a look over the <a href="http://github.com/motanelu/GVim-configuration/blob/master/snippets/zf.snippets" title="Zend Framework snippets">snippets</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2010/01/26/my-vim-configuration/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Vim and python</title>
		<link>http://blog.motane.lu/2009/05/25/vim-and-python/</link>
		<comments>http://blog.motane.lu/2009/05/25/vim-and-python/#comments</comments>
		<pubDate>Mon, 25 May 2009 09:04:01 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=719</guid>
		<description><![CDATA[Few months ago, at a wurbe edition, I&#8217;ve seen two great editors in action: vim and emacs. At first, I was impressed by Alex Nedelcu&#8216;s presentation of emacs and I gave it a try, but I&#8217;ve switched to vim soon after, because emacs just&#8230;&#8221;didn&#8217;t feel right&#8221;. What I liked about emacs was that could be [...]]]></description>
			<content:encoded><![CDATA[<p>Few months ago, at a <a href="http://wurbe.ro/" title="wurbe" class="outgoing">wurbe</a> edition, I&#8217;ve seen two great editors in action: vim and emacs. At first, I was impressed by <a href="http://blog.alexn.org/" title="Alex Nedelcu's blog" class="outgoing">Alex Nedelcu</a>&#8216;s presentation of emacs and I gave it a try, but I&#8217;ve switched to vim soon after, because emacs just&#8230;&#8221;didn&#8217;t feel right&#8221;. What I liked about emacs was that could be easily extended and customised to fit the user&#8217;s needs with lisp. Alex showed us some scripts made by him to improve his productivity. </p>
<p>I also like to customise my tools, and that what drawn me to emacs in the first place. And when I&#8217;ve switched over to vim, I&#8217;ve tried to write some custom plugins, but with vim it&#8217;s not that simple. Vim uses a built in scripting language, which it&#8217;s really weird and badly documented and since it can&#8217;t be used anywhere outside of vim, mastering it would be a waste of time. So I&#8217;ve postponed the customisation of the editor until I had enough time to look over the vim scripting language. Until now. I&#8217;ve recently read an article presenting vim scripting in python, and I&#8217;ve decided to give it a try. And it proved to be much simpler than I&#8217;ve thought.  </p>
<p>First of all, install vim&#8217;s python support. If you&#8217;re an Ubuntu / Debian user, simply pop this in the console:</p>
<pre class="brush: plain; title: ; notranslate">
tudor@thor:~$ sudo apt-get install vim-python
</pre>
<p>If not, compile vim from source / use your package manager to install vim with python support. After vim is up and running, create the two files in the <strong><em>~/.vim/plugin/</em></strong> directory: <strong><em>my_plugin.vim</em></strong> and <strong><em>my_plugin.py</em></strong>.</p>
<p>The  <strong><em>my_plugin.vim</em></strong> should look something like this:</p>
<pre class="brush: plain; title: ; notranslate">
if !has(&quot;python&quot;)
	call confirm(&quot;You must have vim compiled with python in order for this to work&quot;, 'OK')
	finish
endif

if filereadable($HOME.&quot;/.vim/plugin/my_plugin.py&quot;)
	pyfile $HOME/.vim/plugin/my_plugin.py
else
	call confirm(&quot;Error: my_plugin.py cannot be found! Please reinstall the plugin&quot;, 'OK')
	finish
endif

&quot;commands for invoking the functions
command! -nargs=1 MyPluginDoSomething python do_something('&lt;args&gt;')
command! -nargs=1 MyPluginDoSomethingElse python do_something_else('&lt;args&gt;')
</pre>
<p>This is all the vim script you need to know <img src='http://blog.motane.lu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And now, in <strong><em>my_plugin.py</em></strong> file, write your plugin&#8217;s logic in python, knowing that each vim command will call a function from this file:</p>
<pre class="brush: python; title: ; notranslate">
def do_something( argument ):
    print 'wassup %s' % argument

def do_something_else:
    pass
</pre>
<p>If you print something in python, it will be shown in vim&#8217;s error messages area, at the bottom of the window. But the vim module is available in python allows you to read and write into vim&#8217;s buffers and therefore inserting data in the opened document. Type <strong>:help python</strong> in vim for more details. </p>
<p>I&#8217;ve started working on a vim plugin that will aid me with my Zend Framework development. A Zend_Tool integrated with vim that actually does something useful :p</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2009/05/25/vim-and-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

