<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>byronc bits</title>
    <link>http://byron.theclarkfamily.name/blog</link>
    <description>breaking old technology, one bit at a time</description>
    <pubDate>Fri, 04 Jun 2010 03:12:24 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Saving ViM Macros</title>
      <link>http://byron.theclarkfamily.name/blog/2009/03/11/saving-vim-macros</link>
      <pubDate>Wed, 11 Mar 2009 09:32:01 MDT</pubDate>
      <category><![CDATA[tips]]></category>
      <category><![CDATA[vim]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/03/11/saving-vim-macros</guid>
      <description>Saving ViM Macros</description>
      <content:encoded><![CDATA[<p>I use ViM macros (aka <code>complex-repeat</code>) all the time. Occasionally, I find that it would be nice to reuse one of my macros across editing sessions. Turns out it's pretty easy to save the macro. Just add a line like the following to a file that gets sourced when your file is opened by ViM (This example is from <code>~/.vim/ftplugin/rst.vim</code>).
</p>
<div class="highlight"><pre><span class="k">let</span> @<span class="k">h</span> <span class="p">=</span> <span class="c">&quot;yypVr&quot;</span>
</pre></div>


<p>Now, whenever I open a ReStructured Text file, I can hit <code>@h</code> and my macro will run.
</p>]]></content:encoded>
    </item>
    <item>
      <title>More Useful ViM Tags</title>
      <link>http://byron.theclarkfamily.name/blog/2009/03/04/more-useful-vim-tags</link>
      <pubDate>Wed, 04 Mar 2009 20:35:04 MST</pubDate>
      <category><![CDATA[tips]]></category>
      <category><![CDATA[vim]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/03/04/more-useful-vim-tags</guid>
      <description>More Useful ViM Tags</description>
      <content:encoded><![CDATA[<p>Frequently, I find myself writing C code that requires the use of <code>struct
ifreq</code>.  There are plenty of fields there and of course there are other
   structures that I never remember.  I could always look in the headers, but it
   ends up being a good amount of digging before I find the real definition and
   all its accompanying pieces.  So, I decided to let ctags and ViM do the work
   for me.  I created <code>~/bin/update_local_tags</code> with the following contents:
</p>
<div class="highlight"><pre><span class="c">#!/bin/sh</span>
<span class="o">[</span> -d ~/.localtags <span class="o">]</span> <span class="o">||</span> mkdir ~/.localtags
ctags -f ~/.localtags/usrinclude.ctags --exclude<span class="o">=</span>vector<span class="se">\*</span>.hpp -R /usr/include &gt;/dev/null 2&gt;&amp;1
</pre></div>


<p>Then I created <code>~/.vim/ftplugin/c.vim</code> with the following contents:
</p>
<div class="highlight"><pre><span class="k">setlocal</span> <span class="k">tags</span><span class="p">+=</span>$HOME<span class="sr">/.localtags/</span>usrinclude.ctags
</pre></div>


<p>For good measure I copied <code>c.vim</code> to <code>cpp.vim</code> so it would be loaded for C++
   file types also.
</p>
<p>Now I just have to run <code>update_local_tags</code> to generate a tag file for
   everything in <code>/usr/include</code> and ViM automatically includes that list whenever
   I edit a C or C++ file.  Updating the tags file is still a manual process, I
   should probably attempt to hook it into apt.  Observant readers will have
   noticed that I exclude <code>vector*.hpp</code> when generating the tags.  Boost includes
   a few generated header files that match this pattern and swell the tag file to
   almost 750 MiB.
</p>]]></content:encoded>
    </item>
    <item>
      <title>Editing ViM Macros</title>
      <link>http://byron.theclarkfamily.name/blog/2007/03/17/editing-vim-macros</link>
      <pubDate>Sat, 17 Mar 2007 15:16:42 MDT</pubDate>
      <category><![CDATA[tips]]></category>
      <category><![CDATA[vim]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2007/03/17/editing-vim-macros</guid>
      <description>Editing ViM Macros</description>
      <content:encoded><![CDATA[<p>At the <a href="http://uug.byu.edu/">BYU UUG</a> meeting this week, Peter mentioned a
   great ViM trick that I've never seen before. Here's my feeble attempt to
   document it.
</p>
<p>Because ViM macros are stored in registers they can be edited. This means that
   if you create a long macro and then realize that you forgot to send the cursor
   to the beginning of the line before finishing the recording, you don't have to
   create the entire macro again, you can just add the motion command. You use it
   like this:
</p>
<ol>
 <li>
     Start recording your macro by typing <em>q</em> and then the single character (<em>[0-9a-zA-Z"]</em> are allowed). The single character is the register your macro will be stored in.
 </li>

 <li>
     Enter the commands you want included in the macro.
 </li>

 <li>
     Type <em>q</em> to finish recording the macro.
 </li>

 <li>
     At this point you could run the macro by using <em>@</em> and the register name.
 </li>

 <li>
     To modify the macro, move to a blank line and type <em>"Rp</em> replacing <em>R</em> with the register name of your macro. This will paste all the commands in your macro to the current line.
 </li>

 <li>
     After making the changes you need, save the macro by typing <em>0"Ry$</em> replacing <em>R</em> with the register name you want to use for the macro. The register name does not have to be the same as the original.
 </li>
</ol>]]></content:encoded>
    </item>
  </channel>
</rss>
