<?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>Jetpack Flight Log &#187; vim</title>
	<atom:link href="http://jetpackweb.com/blog/tags/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://jetpackweb.com/blog</link>
	<description>Rock{et}ing the interweb</description>
	<lastBuildDate>Wed, 19 May 2010 22:21:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Write HTML Faster with Sparkup (Vim and Textmate)</title>
		<link>http://jetpackweb.com/blog/2010/03/04/write-html-faster-with-sparkup-vim-and-textmate/</link>
		<comments>http://jetpackweb.com/blog/2010/03/04/write-html-faster-with-sparkup-vim-and-textmate/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 18:58:31 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[textmate]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[sparkup]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=770</guid>
		<description><![CDATA[I recently came across a really great Vim(and Textmate) plug-in called sparkup.vim that &#8220;lets you write HTML code faster&#8221;. It&#8217;s actually a small python script, but has editor plug-ins to work with Vim and Textmate. It allows us to write HTML faster by leveraging the terse css selector syntax and converting it the much more [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across a really great Vim(and Textmate) plug-in called <a href="http://github.com/rstacruz/sparkup" target="_blank">sparkup.vim</a> that &#8220;lets you write HTML code faster&#8221;. It&#8217;s actually a small python script, but has editor plug-ins to work with Vim and Textmate. It allows us to write HTML faster by leveraging the terse css selector syntax and converting it the much more verbose HTML.</p>
<h2>Selector Expansion</h2>
<p>Selector expansion is the plug-in&#8217;s primary purpose. It lets you write in a CSS selector syntax that get expanded to full HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family: Monaco, monospace;"><span class="re0">#album</span>.photo</pre></div></div>

<p>If you type that into vim and then press <strong>Ctrl-e</strong> on that line it will be expanded to:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family: Monaco, monospace;"><span class="sc3"><span class="re1">&lt;div</span> <span class="re0">id</span>=<span class="st0">&quot;album&quot;</span> <span class="re0">class</span>=<span class="st0">&quot;photo&quot;</span><span class="re2">&gt;</span></span>|<span class="sc3"><span class="re1">&lt;/div<span class="re2">&gt;</span></span></span></pre></div></div>

<p>This next one is a bit more complicated, I&#8217;ll explain what&#8217;s going on:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family: Monaco, monospace;"><span class="re0">#container</span> <span class="sy0">&gt;</span> <span class="re0">#nav</span> <span class="sy0">&gt;</span> ul <span class="sy0">&gt;</span> li<span class="re1">.first</span> <span class="br0">&#123;</span>Home<span class="br0">&#125;</span> <span class="sy0">+</span> li<span class="sy0">*</span><span class="nu0">2</span> <span class="sy0">+</span> li<span class="re1">.last</span> <span class="br0">&#123;</span>About Us<span class="br0">&#125;</span> &lt; &lt;  <span class="re0">#content</span> <span class="sy0">&gt;</span> p<span class="sy0">*</span><span class="nu0">2</span> &lt; <span class="re0">#footer</span> <span class="sy0">&gt;</span> span<span class="re1">.copyright</span> <span class="br0">&#123;</span><span class="br0">&#40;</span>c<span class="br0">&#41;</span> <span class="nu0">2010</span> Jetpack LLC<span class="br0">&#125;</span></pre></div></div>

<blockquote>
<ol>
<li>Creating a div with the id of &#8220;container&#8221;</li>
<li>Creating a div with an id of &#8220;<i>nav</i>&#8221; that is a child of the &#8220;<i>container</i>&#8221; div. The > specifies we are creating a child element in the DOM tree.</li>
<li>Creating a ul tag that is a child of &#8220;<i>nav</i>&#8220;</li>
<li>Creating an li tag with the class name &#8220;<i>first</i>&#8220;. Text in brackets will be plain text placed in-between the tag we are creating.</li>
<li>Creating two sibling li elements. The <strong>+</strong> denotes what comes next will be a sibling. The <strong>*</strong> is a multiplier to create any number of similar elements.</li>
<li>Creating an li tag with the class name &#8220;<i>last</i>&#8221; as a sibling to the previous li elements we have created. It will contain the text &#8216;<i>About Us</i>&#8216;.</li>
<li>Next now use the <strong><</strong> symbol to go up two levels of the DOM tree.</li>
<li>Next we create a div with the id of &#8220;<i>content</i>&#8221; that will contain two paragraph tags.</li>
<li>We go back up a level and add a footer div that will have a span with the class of &#8220;<i>copyright</i>&#8221; that contains some boilerplate copyright text.</li>
</ol>
</blockquote>
<p>If we press <strong>Ctrl-e</strong> on that line, it will be expanded to the following:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family: Monaco, monospace;">  <span class="sc3"><span class="re1">&lt;div</span> <span class="re0">id</span>=<span class="st0">&quot;container&quot;</span><span class="re2">&gt;</span></span>
    <span class="sc3"><span class="re1">&lt;div</span> <span class="re0">id</span>=<span class="st0">&quot;nav&quot;</span><span class="re2">&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;ul<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;li</span> <span class="re0">class</span>=<span class="st0">&quot;first&quot;</span><span class="re2">&gt;</span></span>Home<span class="sc3"><span class="re1">&lt;/li<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;li<span class="re2">&gt;</span></span></span>|<span class="sc3"><span class="re1">&lt;/li<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;li<span class="re2">&gt;</span></span><span class="re1">&lt;/li<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;li</span> <span class="re0">class</span>=<span class="st0">&quot;last&quot;</span><span class="re2">&gt;</span></span>About Us<span class="sc3"><span class="re1">&lt;/li<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;/ul<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;/div<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;div</span> <span class="re0">id</span>=<span class="st0">&quot;content&quot;</span><span class="re2">&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;p<span class="re2">&gt;</span></span><span class="re1">&lt;/p<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;p<span class="re2">&gt;</span></span><span class="re1">&lt;/p<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;/div<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;div</span> <span class="re0">id</span>=<span class="st0">&quot;footer&quot;</span><span class="re2">&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;span</span> <span class="re0">class</span>=<span class="st0">&quot;copyright&quot;</span><span class="re2">&gt;</span></span>(c) 2010 Jetpack LLC<span class="sc3"><span class="re1">&lt;/span<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;/div<span class="re2">&gt;</span></span></span>
  <span class="sc3"><span class="re1">&lt;/div<span class="re2">&gt;</span></span></span></pre></div></div>

<p>It will also place your cursor in the first empty tag denoted by the <strong>|</strong>. You can jump around to other empty tags with <strong>Ctrl-n</strong> (I change this mapping, more on that in a second).</p>
<p>If you are a fan of <a href="http://haml-lang.com/" target="_blank">HAML</a> but forced to use standard HTML in your projects this plug-in might make you a bit happier.</p>
<h2>Shortcuts</h2>
<p>The other piece of functionality this plug-in provides is a <a href="http://www.vim.org/scripts/script.php?script_id=2540" target="_blank">snipMate</a> like shortcuts feature. These act much like snipMate snippets except they are hard-coded into the python script. However most are still quite useful and you can view the <a href="http://github.com/rstacruz/sparkup/blob/master/sparkup" target="_bank">python script</a> to review them.</p>
<h2>Issues</h2>
<p>After installing this plugin I was having tabbing/tab-expansion issues. I believe it&#8217;s <strong>Ctrl-n</strong> mapping which allows you to jump around to empty tags was conflicting with some other plug-in I had installed, possibly <a href="http://www.vim.org/scripts/script.php?script_id=1643" target="_blank">SuperTab</a>. I remapped it by putting the following in my .vimrc:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family: Monaco, monospace;"><span class="kw1">let</span> g<span class="sy0">:</span>sparkupNextMapping = <span class="st0">'&lt;c-x&gt;'</span></pre></div></div>

<p>That doesn&#8217;t seem to conflict with anything for me, and since it only gets used in normal mode it doesn&#8217;t conflict with Tim Pope&#8217;s excellent <a href="http://github.com/tpope/vim-ragtag" target="_blank">ragtag</a> plug-in (<a href="http://www.catonmat.net/blog/vim-plugins-ragtag-allml-vim/" target="_blank">read more on that here</a>).</p>
<h2>Video Demonstration</h2>
<p>Some of this might make more sense when you see it in action, so watch the following YouTube video(make sure to switch it to 720p for crisper text):</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Jw3jipcenKc&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Jw3jipcenKc&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<h2>Conclusion</h2>
<p>Have fun writing faster HTML! You can see more examples on <a href="http://github.com/rstacruz/sparkup" target="_blank">sparkup&#8217;s Github page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2010/03/04/write-html-faster-with-sparkup-vim-and-textmate/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How to keep your Vim Plugins up to date</title>
		<link>http://jetpackweb.com/blog/2010/01/12/how-to-keep-your-vim-plugins-up-to-date/</link>
		<comments>http://jetpackweb.com/blog/2010/01/12/how-to-keep-your-vim-plugins-up-to-date/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 01:47:51 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=609</guid>
		<description><![CDATA[It&#8217;s not too hard to learn something new everyday about vim, but did you know there is an easy way to keep your plugins up-to-date? GetLatestVimScripts is a plugin that can do just that. You can grab the latest version from the webpage, but it&#8217;s most likely your distributions vim package already has it (Debian, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not too hard to learn something new everyday about vim, but did you know there is an easy way to keep your plugins up-to-date? <a href="http://www.vim.org/scripts/script.php?script_id=642" target="_blank">GetLatestVimScripts</a> is a plugin that can do just that. You can grab the latest version from the webpage, but it&#8217;s most likely your distributions vim package already has it (Debian, Redhat, OSX, and MacPorts do anyway &#8211; check <i>/usr/share/vim/vim72/plugin</i>).</p>
<p>How does it know where to find updates? Either we manually add information about each of our plugins to a special config file, or plugin authors can embed a special comment in their scripts to be update friendly:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">head</span> ~<span class="sy0">/</span>.vim<span class="sy0">/</span>plugin<span class="sy0">/</span>rails.vim</pre></div></div>

<pre style="background-color: #dfdfdf">
" rails.vim - Detect a rails application
" Author:       Tim Pope vimNOSPAM@tpope.info
<b>" GetLatestVimScripts: 1567 1 :AutoInstall: rails.vim</b>
" URL:          http://rails.vim.tpope.net/

" Install this file as plugin/rails.vim.  See doc/rails.txt for details. (Grab
...
</pre>
<p>The bold-ed line will tell the plugin where to find updates. More on that in a minute. First lets create the directory where updates will be downloaded, and a configuration file will be placed:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">mkdir</span> ~<span class="sy0">/</span>.vim<span class="sy0">/</span>GetLatest
<span class="kw2">touch</span> ~<span class="sy0">/</span>.vim<span class="sy0">/</span>GetLatest<span class="sy0">/</span>GetLatestVimScripts.dat</pre></div></div>

<p>By default the plugin will only download the updates and not install them. To enable auto-install put the following in your .vimrc:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family: Monaco, monospace;"><span class="kw1">let</span> g<span class="sy0">:</span>GetLatestVimScripts_allowautoinstall=<span class="nu0">1</span></pre></div></div>

<p>Now run <strong>:GetLatestVimScripts</strong> or <strong>:GLVS</strong>. Vim will analyze your plugins, see if they contain information about their download location, and add it to the .dat file. Then it will <i>wget</i> the plugins and install them. If you had any plugins that were update friendly, they are now updated to the latest version! Since not all plugins are update friendly, you may have to manually add lines to the <i>GetLatest/GetLatestVimScripts.dat</i>. The format looks like this:</p>
<pre>
ScriptID SourceID Filename
--------------------------
294 10110 :AutoInstall: Align.vim
1896 7356 :AutoInstall: allml.vim
1066 7618 :AutoInstall: cecutil.vim
1984 11852 :AutoInstall: FuzzyFinder
1984 11852 :AutoInstall: fuzzyfinder.vim
1567 11920 :AutoInstall: rails.vim
1697 8283 :AutoInstall: surround.vim
</pre>
<p>The first two lines act as comments but are required, so don&#8217;t remove them! Next is the <strong>ScriptID</strong> which is the <i>script_id</i> url parameter on the plugin&#8217;s vim.org webpage (ex: http://www.vim.org/scripts/script.php?<strong>script_id=642</strong>). Then there is the <strong>SourceID</strong> which is a url parameter which identifies the version of the plugin (ex: http://www.vim.org/scripts/download_script.php?<strong>src_id=8283</strong>). The ScriptID is what is compared for newer versions. If you are adding a new plugin, you can just set it to <strong>1</strong>, run an update, and the number will automatically be set to the latest version. <strong>:AutoInstall:</strong> is a flag that signifies the update should be installed after download, and lastly <strong>Filename</strong> is just the filename of the plugin.</p>
<p><a href="http://github.com/anveo/vimfiles/blob/master/GetLatest/GetLatestVimScripts.dat" target="_blank">GetLatestVimScripts.dat</a> is an example of my update configuration. Also checkout my <a href="http://github.com/anveo/vimfiles" target="_blank">vimfiles</a> and <a href="" target="_blank">dotfiles</a> git repos for more vim and shell scripts you might find useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2010/01/12/how-to-keep-your-vim-plugins-up-to-date/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
