<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tim's blog (Posts about hledger)</title><link>https://blog.thechases.com</link><description></description><atom:link href="https://blog.thechases.com/categories/hledger.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:blog@tim.thechases.com"&gt;Tim Chase&lt;/a&gt; </copyright><lastBuildDate>Wed, 02 Dec 2026 02:51:52 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Vim Knowledge Management</title><link>https://blog.thechases.com/posts/vi/vim-knowledge-management/</link><dc:creator>Tim Chase</dc:creator><description>&lt;p&gt;
Another installment of 
&lt;a href="https://lazybear.social/@hyde"&gt;@hyde&lt;/a&gt;'s
&lt;a href="https://lazybea.rs/carnivals"&gt;"Vim Carnival"&lt;/a&gt;,
this time asking,
"How do you use Neovim/Vim to build your knowledge management?"
&lt;/p&gt;

&lt;h2 title="Unstructured"&gt;Unstructured Data&lt;/h2&gt;

&lt;p&gt;
While boring,
I dump all my unstructured "knowledge" data in a simple
&lt;code&gt;notes.txt&lt;/code&gt;
file within my
"personal data/text files"
repo stored in
&lt;code&gt;git&lt;/code&gt;
for syncing between machines.
&lt;/p&gt;

&lt;p&gt;
This file contains a host
of random thoughts and web-clippings.
Disambiguations between words/spellings,
URLs to interesting things with minor annotations,
notes about VPS specs/pricing,
book recommendations,
some favorite jokes,
short poetry-snippets I've composed,
whatever…all tossed together
with timestamps.
&lt;/p&gt;

&lt;p&gt;
Typically I'll either
&lt;code&gt;grep -3&lt;/code&gt;
for things in the file
(including 3 lines of context)
or I'll open it in any
&lt;code&gt;$EDITOR&lt;/code&gt;
to search for things.
&lt;/p&gt;

&lt;p&gt;
I also have a keyboard shortcut
in my window-manager
(&lt;a href="https://fluxbox.org/"&gt;Fluxbox&lt;/a&gt;)
to launch a
&lt;a href="https://blog.thechases.com/posts/vi/vim-knowledge-management/#save"&gt;shell-script&lt;/a&gt;
that uses
&lt;code&gt;zenity&lt;/code&gt;
to prompt me for a description,
then appends the current date+time,
the one-line description,
and the contents of the clipboard
(using &lt;code&gt;xsel&lt;/code&gt;)
to this file.
&lt;/p&gt;

&lt;h2 title="structured"&gt;Structured Data&lt;/h2&gt;

&lt;p&gt;
Depending on the nature of the structured
usually specific tooling gets used to manipulate it.
&lt;/p&gt;

&lt;h3 id="addressbook"&gt;Address book&lt;/h3&gt;

&lt;p&gt;
I keep my personal address book in
&lt;a href="https://www.gnu.org/software/recutils/"&gt;GNU RecUtils&lt;/a&gt;
format.
This plain-text database format
easily lets me add new fields as I have need.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
# people
id: davesmith
household: smith
last: Smith
first: David
nickname: Dave
mother: alicesmith
father: bobsmith
dob: Apr 1 2015
note: in 5th grade class with S

id: alicesmith
household: smith
last: Smith
first: Alice
spouse: bobsmith
phone: 972.555.1212 (c)
phone: 817.555.1234 (h)
email: alice@example.net

⋮

# households
hid: smith
anniversary: Jun 10 2006
street: 3141 Oak St.
city: Anytown
state: PA
zip: 31415
&lt;/pre&gt;
&lt;figcaption&gt;a sample &lt;code&gt;addressbook.txt&lt;/code&gt; excerpt&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;
Most of the time,
I find it easiest to just open the file in my
&lt;code&gt;$EDITOR&lt;/code&gt;
and search for things there
when I need to look someone up.
But I have a few canned queries for doing things like
generating the email contact list for our Christmas email letter.
&lt;/p&gt;

&lt;h3 id="calendar"&gt;Calendar&lt;/h3&gt;

&lt;p&gt;
I use
&lt;a href="https://dianne.skoll.ca/projects/remind/"&gt;Remind&lt;/a&gt;
for calendar-related data.
Thanks to
&lt;a href="https://www.gnu.org/software/recutils/manual/recutils.html"&gt;&lt;code&gt;recsel&lt;/code&gt;&lt;/a&gt;
and a little
&lt;code&gt;awk&lt;/code&gt;
scripting,
I can generate
&lt;code&gt;remind&lt;/code&gt;
entries for
birthdays,
anniversaries,
adoptions,
memorials,
etc.
Then
&lt;code&gt;remind&lt;/code&gt;
can
&lt;code&gt;INCLUDE&lt;/code&gt;
the resulting files.
&lt;/p&gt;

&lt;p&gt;
For other appointments,
they go directly into the corresponding reminder files
—
one for me,
one for my wife, 
one for each kid individually, 
one for the kids combined,
one for the whole household,
one for work,
one for church,
…
&lt;/p&gt;

&lt;p&gt;
I have a
&lt;code&gt;cron&lt;/code&gt;
job that sends each day's
&lt;code&gt;remind&lt;/code&gt;
output to my email,
so I have a copy of the day's reminders and
&lt;a href="https://blog.thechases.com/posts/vi/vim-knowledge-management/#todos"&gt;todo items&lt;/a&gt;.
&lt;/p&gt;

&lt;h3 id="finances"&gt;Finances&lt;/h3&gt;

&lt;p&gt;
I track these as
&lt;a href="https://plaintextaccounting.org/"&gt;plain-text accounting&lt;/a&gt;
plain-text 
which allows me to manage my finances using
&lt;del&gt;&lt;code&gt;ledger&lt;/code&gt;&lt;/del&gt;
&lt;a href="https://hledger.org/"&gt;&lt;code&gt;hledger&lt;/code&gt;&lt;/a&gt;.
&lt;/p&gt;

&lt;h3 id="todos"&gt;&lt;strike&gt;Todos&lt;/strike&gt;&lt;/h3&gt;

&lt;p&gt;
For a long time I kept todo items in
&lt;a href="http://todotxt.org/"&gt;&lt;code&gt;todo.txt&lt;/code&gt;&lt;/a&gt;
format,
and had a symlink for my
&lt;code&gt;~/.plan&lt;/code&gt;
so I could use
&lt;code&gt;finger(1)&lt;/code&gt;
from other machines to fetch my current todo list.
&lt;/p&gt;

&lt;p&gt;
That said, since
&lt;code&gt;remind&lt;/code&gt;
has grown todo-tracking functionality,
most of my todo items have moved into a 
&lt;code&gt;todo.rem&lt;/code&gt;
reminder file.
And I can express repeating todo-items a
&lt;strong&gt;lot&lt;/strong&gt;
more easily now.
&lt;/p&gt;

&lt;h2 title="closing"&gt;Closing&lt;/h2&gt;
&lt;p&gt;
But the best part of all of this?
&lt;strong&gt;It's all plain text.&lt;/strong&gt;
I store it in
&lt;code&gt;git&lt;/code&gt;
and can edit it with any editor,
whether
&lt;code&gt;vim&lt;/code&gt;,
&lt;code&gt;vi&lt;/code&gt;,
&lt;code&gt;ed(1)&lt;/code&gt;,
or even (as noted above)
generated by shell commands.
&lt;/p&gt;

&lt;hr&gt;

&lt;p id="save"&gt;
If interested, here's the shell-script

&lt;/p&gt;&lt;pre&gt;
#!/bin/sh
SAVE_FILE="$HOME/notes.txt"
DESC="$(zenity --title 'Enter description' --entry --text 'Enter description of clipboard contents')"
if [ -n "${DESC}" ]
then
 echo &amp;gt;&amp;gt; $SAVE_FILE
 date +"%Y-%m-%d %H:%M" &amp;gt;&amp;gt; $SAVE_FILE
 echo "${DESC}" &amp;gt;&amp;gt; $SAVE_FILE
 xclip -o -selection clipboard &amp;gt;&amp;gt; $SAVE_FILE
 echo &amp;gt;&amp;gt; $SAVE_FILE
fi
&lt;/pre&gt;</description><category>cli</category><category>hledger</category><category>ledger</category><category>vi</category><category>vim</category><guid>https://blog.thechases.com/posts/vi/vim-knowledge-management/</guid><pubDate>Mon, 15 Jun 2026 19:06:39 GMT</pubDate></item><item><title>Closing out the books in ledger(1)</title><link>https://blog.thechases.com/posts/closing-out-the-books-in-ledger/</link><dc:creator>Tim Chase</dc:creator><description>&lt;aside&gt;
TODO: update this for
&lt;code&gt;hledger&lt;/code&gt;
since I switched away from
&lt;code&gt;ledger&lt;/code&gt;.
&lt;/aside&gt;

&lt;p&gt;
I put this here mostly because I forget how to do it and
have to make multiple starts to get it right.
&lt;/p&gt;

&lt;p&gt;
I have a
&lt;code&gt;wrapper.txt&lt;/code&gt;
file that consists purely of settings
and including my files for my globals
(accounts, commodities, automated transactions, and tags
so that the
&lt;a href="https://ledger-cli.org/doc/ledger3.html#index-_002d_002dpedantic-1"&gt;&lt;code&gt;--pedantic&lt;/code&gt;&lt;/a&gt;
passes),
my transactions,
and my
&lt;a href="https://ledger-cli.org/doc/ledger3.html#Balance-assertions"&gt;balance-assertions&lt;/a&gt;.
&lt;/p&gt;

&lt;figure&gt;
&lt;pre&gt;
--pedantic
include globals.txt
include opening_balances.txt
include transactions.txt
include balance_assertions.txt
&lt;/pre&gt;
&lt;figcaption&gt;my &lt;code&gt;wrapper.txt&lt;/code&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
&lt;pre&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;CUR=&lt;script&gt;document.write(new Date().getFullYear());&lt;/script&gt;&lt;noscript&gt;2025&lt;/noscript&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;PREV=$(($CUR - 1))
&lt;label class="user"&gt;$ &lt;/label&gt;ledger -f &lt;var&gt;wrapper.txt&lt;/var&gt; print \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; -b &lt;var&gt;${PREV}&lt;/var&gt;
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; -e &lt;var&gt;${CUR}&lt;/var&gt; &amp;gt; &lt;var&gt;${PREV}.txt&lt;/var&gt;

&lt;label class="user"&gt;$ &lt;/label&gt;ledger -f &lt;var&gt;wrapper.txt&lt;/var&gt; equity \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; -e &lt;var&gt;${CUR}&lt;/var&gt; \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; -l "commodity == '&lt;var&gt;USD&lt;/var&gt;'" \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; ^Equity: ^Assets: ^Liabilities \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; | sed '$s/\&amp;gt;  .*//' \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; &amp;gt; &lt;var&gt;temp_equity.txt&lt;/var&gt;

&lt;label class="user"&gt;$ &lt;/label&gt;ledger -f &lt;var&gt;wrapper.txt&lt;/var&gt; print \
&lt;label class="user"&gt;&amp;gt; &lt;/label&gt; -b &lt;var&gt;${CUR}&lt;/var&gt; &amp;gt; &lt;var&gt;temp_transactions.txt&lt;/var&gt;

&lt;label class="user"&gt;$ &lt;/label&gt;mv &lt;var&gt;temp_equity.txt&lt;/var&gt; &lt;var&gt;opening_balances.txt&lt;/var&gt;
&lt;label class="user"&gt;$ &lt;/label&gt;mv &lt;var&gt;temp_transactions.txt&lt;/var&gt; &lt;var&gt;transactions.txt&lt;/var&gt;
&lt;/pre&gt;
&lt;figcaption&gt;Closing out the books for the previous year&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;!-- TEASER_END --&gt;

&lt;p&gt;
&lt;strong&gt;Note:&lt;/strong&gt;
I keep my
&lt;code&gt;ledger&lt;/code&gt;
files in
&lt;code&gt;git&lt;/code&gt;
so I have a fair bit of freedom to experiment.
If I mess things up beyond repair,
I can always
&lt;code&gt;git reset --hard&lt;/code&gt;
to revert to the most recent snapshot.
&lt;strong&gt;I recommend you make a backup as well.&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
To make this easier,
I start by setting a few variables
for the current year and the previous year.
This allows me to update one variable
then copy/paste the rest of the instructions
to close the books in subsequent years.
&lt;/p&gt;

&lt;p&gt;
The first
&lt;code&gt;print&lt;/code&gt;
step pulls all transactions beginning
(&lt;code&gt;-b&lt;/code&gt;)
after the previous year and ending
(&lt;code&gt;-e&lt;/code&gt;)
before the current year into
&lt;code&gt;${PREV}.txt&lt;/code&gt;
as an archive.
&lt;/p&gt;

&lt;p&gt;
Next, I create a temporary file
containing the
&lt;q&gt;Opening Balances&lt;/q&gt;
for the period ending
(&lt;code&gt;-e&lt;/code&gt;)
before the current year using the
&lt;code&gt;equity&lt;/code&gt;
command.
In my case,
I also want to limit my commodities
(&lt;code&gt;-l "commodity == '&lt;var&gt;USD&lt;/var&gt;'"&lt;/code&gt;)
to "USD" only
because I don't want to carry forward
my gallons-of-gasoline and the like.
Similarly, I only want
Equity, Assets, and Liabilities
because I've found
that including Income &amp;amp; Expenses
gives me some unexpected results at times.
I also use
&lt;code&gt;sed&lt;/code&gt;
to make the final
"Equity:Opening Balances"
transaction an auto-balancing transaction.
&lt;/p&gt;

&lt;p&gt;
Finally, I need to filter out all
those archived transactions
so I use
&lt;code&gt;print&lt;/code&gt;
to select only the transactions beginning
(&lt;code&gt;-b&lt;/code&gt;)
on
&lt;var&gt;${CUR}&lt;/var&gt;
into a second temporary file.
&lt;/p&gt;

&lt;p&gt;
At this point,
we can move the
&lt;code&gt;temp_equity.txt&lt;/code&gt;
back atop the original
&lt;code&gt;opening_balances.txt&lt;/code&gt;
and move the
&lt;code&gt;temp_transactions.txt&lt;/code&gt;
back atop the original
&lt;code&gt;transactions.txt&lt;/code&gt;
file.
&lt;/p&gt;

&lt;p&gt;
With all that,
I usually run a
&lt;code&gt;ledger bal&lt;/code&gt;
to verify that everything balances as I expect.
If so, I add the
&lt;code&gt;${PREV}.txt&lt;/code&gt;wrapper.txt
and updated
&lt;code&gt;transactions.txt&lt;/code&gt;
files,
commit them,
and push them out to my other hosts.
&lt;/p&gt;</description><category>cli</category><category>hledger</category><category>ledger</category><guid>https://blog.thechases.com/posts/closing-out-the-books-in-ledger/</guid><pubDate>Wed, 11 Jan 2023 14:34:56 GMT</pubDate></item></channel></rss>