<?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>Wed, 11 Jan 2012 04:59:47 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Hooked on org-mode</title>
      <link>http://byron.theclarkfamily.name/blog/2012/01/10/hooked-on-org-mode</link>
      <pubDate>Tue, 10 Jan 2012 20:46:48 MST</pubDate>
      <category><![CDATA[emacs]]></category>
      <category><![CDATA[vim]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2012/01/10/hooked-on-org-mode</guid>
      <description>Hooked on org-mode</description>
      <content:encoded><![CDATA[<p>So, what's a long-time ViM user doing with an Emacs session running
all the time? Using org-mode of course.</p>
<p>First a little bit of a problem statement: I forget everything. I've
tried lots of different ways to solve the problem. I started with
writing a TODO list at the beginning of each day. For a while I
succeeded in using a Palm Pilot to keep track of everything. Next was
a Google Calendar. For stuff that didn't fit in the calendar I tried
to keep a personal wiki. Each method ended up in failure because it was
cumbersome. Let me be clear, to me cumbersome means <em>requires more
work than typing on a keyboard</em>.</p>
<p>I was pretty excited when I heard about
<a href="http://orgmode.org/">org-mode</a>. Look at the slogan: <em>Your Life in
Plain Text</em>. How could that not be good? Not being a
<a href="http://www.stallman.org/saint.html">Saint in the Church of Emacs</a> it
took me a little longer to get comfortable with org-mode, but it was
worth it. I'm sure my org-mode use hardly scratches the surface of
what's possible, but it's been enough to keep me organized for the
past year.</p>
<p>Here's what it took to get started. I created a directory called
<code>~/notes</code> and added the following to my Emacs startup files:</p>
<div class="pygments_tomorrow-night"><pre><span class="p">(</span><span class="nf">add-to-list</span> <span class="ss">&#39;auto-mode-alist</span> <span class="o">&#39;</span><span class="p">(</span><span class="s">&quot;\\.org$&quot;</span> <span class="o">.</span> <span class="nv">org-mode</span><span class="p">))</span>

<p><span class="p">(</span><span class="nf">global-set-key</span> <span class="s">&quot;C-cl&quot;</span> <span class="ss">&#39;org-store-link</span><span class="p">)</span>
<span class="p">(</span><span class="nf">global-set-key</span> <span class="s">&quot;C-ca&quot;</span> <span class="ss">&#39;org-agenda</span><span class="p">)</span>
<span class="p">(</span><span class="nf">global-set-key</span> <span class="s">&quot;C-cb&quot;</span> <span class="ss">&#39;org-iswitchb</span><span class="p">)</span></p>
<p><span class="p">(</span><span class="nf">setq</span> <span class="nv">org-log-done</span> <span class="nv">t</span><span class="p">)</span>
<span class="p">(</span><span class="nf">setq</span> <span class="nv">org-log-repeat</span> <span class="s">&quot;time&quot;</span><span class="p">)</span></p>
<p><span class="p">(</span><span class="nf">add-hook</span> <span class="ss">&#39;org-mode-hook</span> <span class="ss">&#39;turn-on-auto-fill</span><span class="p">)</span></p>
<p><span class="p">(</span><span class="nf">setq</span> <span class="nv">org-directory</span> <span class="s">&quot;~/notes&quot;</span><span class="p">)</span>
<span class="p">(</span><span class="nf">setq</span> <span class="nv">org-agenda-files</span> <span class="p">(</span><span class="nf">file-expand-wildcards</span> <span class="s">&quot;~/notes/*.org&quot;</span><span class="p">))</span>
</pre></div></p>
<p>Whenever I want to record something I open up a relevant <code>.org</code> file
in <code>~/notes</code> and add entries like this:</p>
<div class="pygments_tomorrow-night"><pre>* Chores
** Empty garbages
** Mow lawn
</pre></div>

<p>It's just an outline, with the number of leading <code>*</code> characters
determining the level of each entry.</p>
<p>The only keys I really use frequently are:</p>
<ul>
<li><code>C-c C-t</code>: transition states (make this a TODO or mark it done)</li>
<li><code>C-c C-s</code>: schedule this entry</li>
<li><code>C-c C-d</code>: set a deadline for this entry</li>
<li><code>Tab</code>: fold (show/hide children of this entry)</li>
<li><code>C-c a a</code>: show the agenda for the current week</li>
</ul>
<p>org-mode is far more customizable, but for me, that's enough. I'm
especially pleased at how easy it is just to start logging things that
happen in a meeting or adding something that I just remembered needing
to do around the house. There's almost no friction. And everything
about the entry lives in the text file. Then, with a few key presses
(<code>C-c a a</code>) I know what my next week looks like.</p>]]></content:encoded>
    </item>
    <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="pygments_tomorrow-night"><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="pygments_tomorrow-night"><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="pygments_tomorrow-night"><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>

