<?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>Guy Rutenberg &#187; vim</title>
	<atom:link href="http://www.guyrutenberg.com/category/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Wed, 16 Jun 2010 19:53:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Vim Syntax Highlighting For Google Gadgets</title>
		<link>http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/</link>
		<comments>http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 20:26:28 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/</guid>
		<description><![CDATA[I started developing Google Gadgets for LabPixies, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets&#8217; code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I [...]]]></description>
			<content:encoded><![CDATA[<p>I started developing Google Gadgets for <a href="http://www.labpixies.com">LabPixies</a>, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets&#8217; code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I didn&#8217;t like as it required me to wrap the HTML code with a specific comment. As I don&#8217;t like this kind of solution, I&#8217;ve decided to create my own syntax highlighting file for Vim.<br />
<span id="more-47"></span></p>
<p>Save the following code under <code>~/.vim/syntax/google_gadgets.vim</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot; Vim syntax file for Google gadgets module files.</span>
<span style="color: #adadad; font-style: italic;">&quot; Maintainer: Guy Rutenberg &lt;http://www.guyrutenberg.com&gt;</span>
<span style="color: #adadad; font-style: italic;">&quot; Last Change: 2008 Mar 28</span>
<span style="color: #adadad; font-style: italic;">&quot;</span>
&nbsp;
<span style="color: #000000;">:</span>syntax clear
&nbsp;
runtime<span style="color: #000000;">!</span> syntax<span style="color: #000000;">/</span>xml<span style="color: #000000;">.</span>vim
&nbsp;
<span style="color: #804040;">unlet</span> b<span style="color: #000000;">:</span>current_syntax
<span style="color: #000000;">:</span>syntax include <span style="color: #000000;">@</span>HTML syntax<span style="color: #000000;">/</span>html<span style="color: #000000;">.</span>vim
<span style="color: #000000;">:</span>syntax region HTMLcode matchgroup=CDATA start=<span style="color: #000000;">/&lt;</span>Content\s\<span style="color: #000000;">+</span><span style="color: #25BB4D;">type</span>=<span style="color: #C5A22D;">&quot;html&quot;</span>\s<span style="color: #000000;">*&gt;</span>\_s<span style="color: #000000;">*&lt;!</span>\<span style="color: #000000;">&#91;</span>CDATA\<span style="color: #000000;">&#91;</span><span style="color: #000000;">/</span> <span style="color: #804040;">end</span>=<span style="color: #000000;">/</span>\<span style="color: #000000;">&#93;</span>\<span style="color: #000000;">&#93;</span><span style="color: #000000;">&gt;</span>\_s<span style="color: #000000;">*&lt;</span>\<span style="color: #000000;">/</span>Content<span style="color: #000000;">&gt;/</span> contains=<span style="color: #000000;">@</span>HTML
&nbsp;
syn keyword javaScriptReserved _IG_Prefs getString getInt getBool getArray set setArray dump _IG_FetchContent _IG_FetchXmlContent _IG_FetchFeedAsJSON _IG_RegisterOnloadHandler _gel _gelstn _esc _unesc _trim _uc _min _max _hesc _args _toggle _IG_GetImage _IG_GetCachedUrl
<span style="color: #804040;">let</span> b<span style="color: #000000;">:</span>current_syntax = <span style="color: #C5A22D;">&quot;google_gadgets&quot;</span></pre></div></div>

<p>And add the following line to your <code>.vimrc</code></p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">au BufRead <span style="color: #000000;">&lt;</span>google_gadgets<span style="color: #000000;">&gt;</span> runtime<span style="color: #000000;">!</span> syntax<span style="color: #000000;">/</span>google_gadgets<span style="color: #000000;">.</span>vim</pre></div></div>

<p>The current syntax highlighting will highlight the XML part as XML, and if your gadget contains an HTML part, it will highlight it too (including CSS and JavaScript). I&#8217;ve also registered the core JavaScript library of the Google Gadgets API as JavaScript keywords so they will get highlighted too.</p>
<p>The line you added to the <code>.vimrc</code> file will automatically load the syntax highlighting for files of type <code>google_gadgets</code>. While this file type isn&#8217;t automatically detected, you can easily set one by typing <code>:set filetype=google_gadget</code>.</p>
<p>Tip: If you want some file to always be detected as <code>google_gadget</code> add the following modeline to it:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">&lt;!--</span> vim<span style="color: #000000;">:</span> set filetype=google_gadgets <span style="color: #000000;">:</span> <span style="color: #000000;">--&gt;</span></pre></div></div>

<p>(you got to have modelines enabled for this to work).</p>
<p>Some things are still missing, such as highlighting for all the keywords and methods of the API, and automatic file type detection. I plan to address those issue as time will permit me. If you think I&#8217;ve left out some important functionality that should belong with this code, please comment or contact me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up OmniComplete (Autocompletion) for wxWidgets in Vim</title>
		<link>http://www.guyrutenberg.com/2008/02/23/setting-up-omnicomplete-autocompletion-for-wxwidgets-in-vim/</link>
		<comments>http://www.guyrutenberg.com/2008/02/23/setting-up-omnicomplete-autocompletion-for-wxwidgets-in-vim/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 19:27:11 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[wxWidgets]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2008/02/23/setting-up-omnicomplete-autocompletion-for-wxwidgets-in-vim/</guid>
		<description><![CDATA[I use Vim as my main IDE for C/C++ related development (as well as for almost all other development). If you use (or thinking about using) vim as as an IDE, you better get some good autocompletion functionality. This kind of autocompletion is provided by the OmniComplete, which is available since Vim 7.0. Just having [...]]]></description>
			<content:encoded><![CDATA[<p>I use Vim as my main IDE for C/C++ related development (as well as for almost all other development). If you use (or thinking about using) vim as as an IDE, you better get some good autocompletion functionality. This kind of autocompletion is provided by the OmniComplete, which is available since Vim 7.0. Just having  the OmniComplete is a nice thing, but it&#8217;s much more helpful if configured properly to work with the libraries you use, such as wxWidgets. In this post I will show you how to get working the OmniComplete for wxWidgets, however, the procedure I will show can be easily adapted to almost all libraries.<br />
<span id="more-41"></span></p>
<p>The first step is to install <code>ctags</code> (if you haven&#8217;t got it already installed), this provides the tags file, on which the autocompletion is based. <code>ctags</code> is available directly from the package manager of all popular distro&#8217;s.</p>
<p>The next step is to install the <a href="http://www.vim.org/scripts/script.php?script_id=1520">OmniCppComplete</a> plugin for vim. The plugin uses the <code>ctags</code>&#8216; generated tags file for the autocompletion. In order for the autocompletion to properly work with classes, you need to create the <code>~/.ctags</code> file and add some default options. Each option should be listed in a newline. Your <code>~/.ctags</code> file should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">--c++-kinds=+p
--fields=+iaS
--extra=+q</pre></div></div>

<p>These options will now be used as default when running <code>ctags</code>.</p>
<p>The next step is to create a tag file for the wxWidgets library. This can be done using the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> ctags -f ~/.vim/wxwidgetstags -R /usr/include/wx-2.8</pre></div></div>

<p>Don&#8217;t forget to replace <code>/usr/include/wx-2.8</code> with the path to the header files of wxWidgets. This will create the tags file under your <code>~/.vim</code> directory.</p>
<p>The next step is to tell vim to use this tags file. This is done by adding the following line to your <code>~/.vimrc</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">:set tags+=~/.vim/wxwidgetstags</pre></div></div>

<p>And now your done. OmniComplete will now work for wxWidgets, listing members and functions for any of the wxWidgets classes.<br />
Remember you can repeat the last two steps for any other libraries you use in order for the OmniComplete to work with them too.</p>
<p>N.B. don&#8217;t forget to run <code>ctags -R .</code> in your projects root dir if you want OmniComplete to work for classes you defined.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/02/23/setting-up-omnicomplete-autocompletion-for-wxwidgets-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim Macros for Wrapping Strings for Gettext</title>
		<link>http://www.guyrutenberg.com/2007/12/22/vim-macros-for-wrapping-strings-for-gettext/</link>
		<comments>http://www.guyrutenberg.com/2007/12/22/vim-macros-for-wrapping-strings-for-gettext/#comments</comments>
		<pubDate>Sat, 22 Dec 2007 10:52:20 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[Gettext]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2007/12/22/vim-macros-for-wrapping-strings-for-gettext/</guid>
		<description><![CDATA[I&#8217;m working on a website and we decided to localize it using GNU gettext. Soon enough I found it tiring to wrap each string manually in _( and ) and also to do it in Smarty (using {t}string{/t}. So I decided that I need a macro that will let highlight the string that needs translation [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a website and we decided to localize it using <a href="http://www.gnu.org/software/gettext/">GNU gettext</a>. Soon enough I found it tiring to wrap each string manually in <code>_(</code> and <code>)</code> and also to do it in <a href="http://smarty.php.net">Smarty</a> (using <code>{t}string{/t}</code>. So I decided that I need a macro that will let highlight the string that needs translation and the macro will wrap for me. </p>
<p>I ended up writing two macros one for PHP files (but it&#8217;s also good for C/C++ etc.) and one for smarty.</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">:</span>vmap tg di_<span style="color: #000000;">&#40;</span><span style="color: #000000;">&lt;</span>ESC<span style="color: #000000;">&gt;</span>pa<span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>ESC<span style="color: #000000;">&gt;</span>
<span style="color: #000000;">:</span>vmap ts di<span style="color: #000000;">&#123;</span>t<span style="color: #000000;">&#125;</span><span style="color: #000000;">&lt;</span>ESC<span style="color: #000000;">&gt;</span>pa<span style="color: #000000;">&#123;</span><span style="color: #000000;">/</span>t<span style="color: #000000;">&#125;</span><span style="color: #000000;">&lt;</span>ESC<span style="color: #000000;">&gt;</span></pre></div></div>

<p>To use these macros just highlight the string for translation in vim&#8217;s visual mode and press <code>tg</code> (or <code>ts</code>), and your string will be wrapped for translation. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2007/12/22/vim-macros-for-wrapping-strings-for-gettext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

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