From af9a5edd1fd65b504cad8eee4c2097b8db7de1e0 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 19 Jun 2023 01:24:08 +0530 Subject: new post: plain text journaling --- docs/index.html | 24 +- docs/index.xml | 241 +++++++++++++++++++ docs/posts/index.html | 17 ++ docs/posts/plain_text_journaling/index.html | 308 ++++++++++++++++++++++++ posts/plain_text_journaling.md | 347 ++++++++++++++++++++++++++++ 5 files changed, 925 insertions(+), 12 deletions(-) create mode 100644 docs/posts/plain_text_journaling/index.html create mode 100644 posts/plain_text_journaling.md diff --git a/docs/index.html b/docs/index.html index 7b2b6b6..10ed746 100644 --- a/docs/index.html +++ b/docs/index.html @@ -40,15 +40,15 @@
- 03/09 — 2022 + 19/06 — 2023
- - Curing A Case Of Git-UX + + Plain Text Journaling - 9.6 + 8.9 min @@ -57,15 +57,15 @@
- 28/08 — 2022 + 03/09 — 2022
- - Programming On 34 Keys + + Curing A Case Of Git-UX - 6.2 + 9.6 min @@ -74,15 +74,15 @@
- 02/08 — 2022 + 28/08 — 2022
- - A Reference Counted Afterlife + + Programming On 34 Keys - 1.6 + 6.2 min diff --git a/docs/index.xml b/docs/index.xml index c0277f1..eb43379 100644 --- a/docs/index.xml +++ b/docs/index.xml @@ -12,6 +12,247 @@ en-us Creative Commons BY-NC-SA 4.0 +Plain Text Journaling +<p>I cobbled together a journaling system with {neo,}vim, coreutils and +<a href="http://www.fresse.org/dateutils">dateutils</a>. This system is +loosely based on <a href="https://www.rydercarroll.com/">Ryder +Caroll’s</a> Bullet Journal method.</p> +<p><a href="https://u.peppe.rs/SpF.png"><img +src="https://u.peppe.rs/SpF.png" /></a></p> +<h3 id="the-format">The format</h3> +<p>The journal for a given year is a directory:</p> +<div class="sourceCode" id="cb1"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> ls journal/</span> +<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">2022/</span> 2023/</span></code></pre></div> +<p>In each directory are 12 files, one for each month of the year, +numbered like so:</p> +<div class="sourceCode" id="cb2"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> ls journal/2023/</span> +<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">01</span> 02 03 04 05 06 07 08 09 10 11 12</span></code></pre></div> +<p>We can now begin writing stuff down:</p> +<div class="sourceCode" id="cb3"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> vim journal/2023/1</span></code></pre></div> +<p>Every month must start with a calendar of course, fill that in +with:</p> +<pre class="vim"><code>:read !cal -m</code></pre> +<p>Your entry for January might look like this:</p> +<div class="sourceCode" id="cb5"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> cat journal/2023/01</span> +<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">January</span> 2023</span> +<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">Mo</span> Tu We Th Fr Sa Su</span> +<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">1</span></span> +<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">2</span> 3 4 5 6 7 8</span> +<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">9</span> 10 11 12 13 14 15</span> +<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="ex">16</span> 17 18 19 20 21 22</span> +<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="ex">23</span> 24 25 26 27 28 29</span> +<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a><span class="ex">30</span> 31</span></code></pre></div> +<p>I prefer planning week by week, as opposed to creating a task-list +every day, here’s what I have for the first couple of weeks:</p> +<pre><code> January 2023 +Mo Tu We Th Fr Sa Su + 1 + 2 3 4 5 6 7 8 + 9 10 11 12 13 14 15 +16 17 18 19 20 21 22 +23 24 25 26 27 28 29 +30 31 + + +week 1 + +done apply leaves +done dload boarding pass +moved reply to dan + + +week 2 + +todo reply to dan +todo pack bags +done travel insurance +todo weigh luggage</code></pre> +<p>I start the week by writing a header and each item that week is +placed on its own line. The items are prefixed with a <code>todo</code> +or a <code>done</code> signifier.</p> +<h3 id="form-over-function">Form over function</h3> +<p>Right off the bat, the signifiers look very noisy, Even more so once +we start introducing variety (I use “event”, “note” and “moved”):</p> +<pre><code>week 1 + +todo apply leaves +done dload boarding pass +todo reply to dan +event fr trip +note weight 68.6</code></pre> +<p>We can clean this up with “abbreviations” +(<code>:h abbreviations</code>):</p> +<pre class="vim"><code>:iabbrev todo · +:iabbrev done ×</code></pre> +<p>Now, typing this:</p> +<pre><code>todo apply leaves</code></pre> +<p>Automatically inserts:</p> +<pre><code>· apply leaves</code></pre> +<p>You can use <code>x</code> and <code>o</code> as well, but +<code>×</code> (U+00D7, MULTIPLICATION SIGN) and <code>·</code> (U+00B7, +MIDDLE DOT) are more … <em>gourmet</em>.</p> +<p>The other signifiers I use are:</p> +<ul> +<li><code>-</code> for note</li> +<li><code>o</code> for event</li> +<li><code>&gt;</code> for moved.</li> +</ul> +<p>Nit #2 is the lack of order. We can employ vim to introduce grouping +and sorting. Select the list of entries for this week:</p> +<pre class="vim"><code>vip &quot; line-wise select inner paragraph +:&#39;&lt;,&#39;&gt;sort &quot; the markers &#39;&lt; and &#39;&gt; are automatically inserted, + &quot; they mark the start and end of the selection</code></pre> +<p>We end up with:</p> +<pre><code>week 1 + +· apply leaves +· reply to dan +× dload boarding pass</code></pre> +<p>The lines are grouped by their signifiers, segregating todo items +from completed items. Luckily, MIDDLE DOT is lesser than MULTIPLICATION +SIGN, so todo items are placed at the top. The same goes for +<code>o</code> and <code>x</code> symbols, either set of signifiers will +result in the same sorting order.</p> +<p>We can shorten this select-paragraph-invoke-sort dance by setting the +<code>formatprg</code> variable:</p> +<pre class="vim"><code>:set formatprg=sort\ -V</code></pre> +<p>Now, hitting <code>gqip</code> should automatically group and sort +the items for the week under the cursor, moving todo items to the top. +Finding signifier glyphs that suit your sorting preference is a fun +exercise.</p> +<h3 id="syntax-highlighting">Syntax highlighting</h3> +<p>Adding color to items introduces another layer of visual distinction. +In truth, I like to deck it out just because.</p> +<p>First, create a few syntax groups:</p> +<pre class="vim"><code>:syntax match JournalAll /.*/ &quot; captures the entire buffer +:syntax match JournalDone /^×.*/ &quot; lines containing &#39;done&#39; items: × +:syntax match JournalTodo /^·.*/ &quot; lines containing &#39;todo&#39; items: · +:syntax match JournalEvent /^o.*/ &quot; lines containing &#39;event&#39; items: o +:syntax match JournalNote /^- .*/ &quot; lines containing &#39;note&#39; items: - +:syntax match JournalMoved /^&gt;.*/ &quot; lines containing &#39;moved&#39; items: &gt;</code></pre> +<p>Add highlights to each group:</p> +<pre class="vim"><code>:highlight JournalAll ctermfg=12 &quot; bright black +:highlight JournalDone ctermfg=12 &quot; bright black +:highlight JournalEvent ctermfg=6 &quot; cyan +:highlight JournalMoved ctermfg=5 &quot; magenta +:highlight JournalNote ctermfg=3 &quot; yellow</code></pre> +<p>In my terminal, this is rendered like so:</p> +<p><a href="https://u.peppe.rs/Du6.png"><img +src="https://u.peppe.rs/Du6.png" /></a></p> +<h3 id="habit-tracking">Habit tracking</h3> +<p>While this is not a part of my journaling system anymore, a few +headers and an awk script is all it takes to track habits. My weekly +entries would include a couple of habit headers like so:</p> +<pre><code>week 1 -------------- + +× wake up on time +× water the plants + +spend 7.5 7 10 +--------------------- + + +week 2 -------------- + +· make the bed +· go to bed + +spend 30 2.75 6 +---------------------</code></pre> +<p>Here, under the <code>spend</code> header in week 1, are a list of +expenditures accumulated over the week. The monthly spend is calculated +with this awk script:</p> +<div class="sourceCode" id="cb17"><pre +class="sourceCode awk"><code class="sourceCode awk"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="cf">BEGIN</span> <span class="op">{</span>spend<span class="op">=</span><span class="dv">0</span><span class="op">;}</span></span> +<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="ot">/</span><span class="ss">spend</span><span class="ot">/</span> <span class="op">{</span><span class="cf">for</span><span class="op">(</span>i<span class="op">=</span><span class="dv">1</span><span class="op">;</span>i<span class="op">&lt;=</span><span class="dt">$NF</span><span class="op">;</span>i<span class="op">++)</span> spend<span class="op">+=</span><span class="dt">$i</span><span class="op">;}</span></span> +<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="cf">END</span> <span class="op">{</span> <span class="kw">printf</span> spend <span class="st">&quot;eur&quot;</span><span class="op">}</span></span></code></pre></div> +<p>And invoked like so:</p> +<pre><code>λ awk -f spend.awk journal/2023/01 +63.25eur</code></pre> +<h3 id="reflection">Reflection</h3> +<p>Journaling is not just about planning what is to come, but also +reflecting on what has passed. It would make sense to simultaneously +look at the past few weeks’ entries while making your current one. To +open multiple months of entries at the same time:</p> +<pre><code>λ vim -O journal/2023/0{1,2,3}</code></pre> +<p>Opens 3 months, side-by-side, in vertical splits:</p> +<pre><code>JANUARY ------------ │ FEBRUARY ----------- │ MARCH -------------- + │ │ +Mo Tu We Th Fr Sa Su │ Mo Tu We Th Fr Sa Su │ Mo Tu We Th Fr Sa Su + 1 │ 1 2 3 4 5 │ 1 2 3 4 5 + 2 3 4 5 6 7 8 │ 6 7 8 9 10 11 12 │ 6 7 8 9 10 11 12 + 9 10 11 12 13 14 15 │ 13 14 15 16 17 18 19 │ 13 14 15 16 17 18 19 +16 17 18 19 20 21 22 │ 20 21 22 23 24 25 26 │ 20 21 22 23 24 25 26 +23 24 25 26 27 28 29 │ 27 28 │ 27 28 29 30 31 +30 31 │ │ + │ │ + │ │ +WEEK 1 ------------- │ WEEK 1 ------------- │ WEEK 1 ------------- + │ │ +&gt; latex setup │ &gt; forex │ - weight: 64 +× make the bed │ × clean shoes │ &gt; close sg-pr +× 03: dentist │ × buy clothes │ × facewash +× integrate tsg │ × draw │ × groceries + │ │ + │ │ +WEEK 2 ------------- │ WEEK 2 ------------- │ WEEK 2 ------------- + │ │ +× latex setup │ - viral fever │ &gt; close sg-pr +× send invoice │ × forex │ × plan meet +× stack-graph pr │ × activate sim │ × sg storage + │ × bitlbee │</code></pre> +<h3 id="reducing-friction">Reducing friction</h3> +<p>Journaling already requires a solid amount of discipline and +consistency. The added friction of typing +<code>vim journal/$CURRENT_YEAR/$CURRENT_MONTH</code> each time is doing +no favors.</p> +<p>To open the current month based on system time:</p> +<div class="sourceCode" id="cb21"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> vim <span class="va">$(</span><span class="fu">date</span> +<span class="st">&quot;%Y/%m&quot;</span><span class="va">)</span></span></code></pre></div> +<p>To open all the months within a 2 month window of today, is a little +trickier. The command we wish to generate is (if today is 2023/12):</p> +<div class="sourceCode" id="cb22"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> vim <span class="at">-O</span> 2023/10 2023/11 2023/12 2024/01 2024/02</span></code></pre></div> +<p>And that is where <code>dateseq</code> from <a +href="http://www.fresse.org/dateutils">dateutils</a> comes in handy, for +example:</p> +<div class="sourceCode" id="cb23"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> dateseq 2012-02-01 2012-03-01</span> +<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a><span class="ex">2012-02-01</span></span> +<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a><span class="ex">2012-02-02</span></span> +<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a><span class="ex">2012-02-03</span></span> +<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a><span class="ex">...</span></span> +<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a><span class="ex">2012-02-28</span></span> +<span id="cb23-7"><a href="#cb23-7" aria-hidden="true" tabindex="-1"></a><span class="ex">2012-02-29</span></span> +<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a><span class="ex">2012-03-01</span></span></code></pre></div> +<p>This script opens all months within a 2 month window of today:</p> +<div class="sourceCode" id="cb24"><pre +class="sourceCode bash"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="ex">λ</span> vim <span class="at">-O</span> <span class="va">$(</span></span> +<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">dateseq</span> <span class="dt">\</span></span> +<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;</span><span class="va">$(</span><span class="fu">date</span> <span class="at">--date</span> <span class="st">&quot;2 months ago&quot;</span> +%Y/%m<span class="va">)</span><span class="st">&quot;</span> <span class="dt">\</span></span> +<span id="cb24-4"><a href="#cb24-4" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;</span><span class="va">$(</span><span class="fu">date</span> <span class="at">--date</span> <span class="st">&quot;2 months&quot;</span> +%Y/%m<span class="va">)</span><span class="st">&quot;</span> <span class="dt">\</span></span> +<span id="cb24-5"><a href="#cb24-5" aria-hidden="true" tabindex="-1"></a> <span class="at">-i</span> %Y/%m <span class="dt">\</span></span> +<span id="cb24-6"><a href="#cb24-6" aria-hidden="true" tabindex="-1"></a> <span class="at">-f</span> %Y/%m</span> +<span id="cb24-7"><a href="#cb24-7" aria-hidden="true" tabindex="-1"></a><span class="va">)</span></span></code></pre></div> +<h3 id="fin">Fin</h3> +<p>You can find a sample vimrc file here: <a +href="https://git.peppe.rs/cli/journal/tree">cli/journal</a>, along with +a nix flake file to kick things off.</p> +<p>Plain text journaling can be just as much fun as a pen and paper. +Throw in some ASCII art for each month, use swankier signifiers, or +louder syntax highlighting. Don’t expect forgiveness from org-mode users +though.</p> +<p><a href="https://u.peppe.rs/ZCK.png"><img +src="https://u.peppe.rs/ZCK.png" /></a></p> +https://peppe.rs/posts/plain_text_journaling/ +Sun, 18 Jun 2023 19:40:00 +0000 +https://peppe.rs/posts/plain_text_journaling/ + + Curing A Case Of Git-UX <p>Git worktrees are great, but they fall behind the venerable <code>git checkout</code> sometimes. I attempted to fix that with <a diff --git a/docs/posts/index.html b/docs/posts/index.html index 4ed7f2d..9fcc773 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -24,6 +24,23 @@
+ + + + +
+
+ 19/06 — 2023 +
+ + Plain Text Journaling + +
+ + 8.9 + + min +
diff --git a/docs/posts/plain_text_journaling/index.html b/docs/posts/plain_text_journaling/index.html new file mode 100644 index 0000000..1ef9011 --- /dev/null +++ b/docs/posts/plain_text_journaling/index.html @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + Plain Text Journaling · peppe.rs + +
+
+ Home + / + Posts + / + Plain Text Journaling + View Raw +
+
+ 19/06 — 2023 +
+ + 138.66 + + cm +   + + 8.9 + + min +
+
+

+ Plain Text Journaling +

+
+

I cobbled together a journaling system with {neo,}vim, coreutils and +dateutils. This system is +loosely based on Ryder +Caroll’s Bullet Journal method.

+

+

The format

+

The journal for a given year is a directory:

+
λ ls journal/
+2022/   2023/
+

In each directory are 12 files, one for each month of the year, +numbered like so:

+
λ ls journal/2023/
+01  02  03  04  05  06  07  08  09  10  11  12
+

We can now begin writing stuff down:

+
λ vim journal/2023/1
+

Every month must start with a calendar of course, fill that in +with:

+
:read !cal -m
+

Your entry for January might look like this:

+
λ cat journal/2023/01
+    January 2023
+Mo Tu We Th Fr Sa Su
+                   1
+ 2  3  4  5  6  7  8
+ 9 10 11 12 13 14 15
+16 17 18 19 20 21 22
+23 24 25 26 27 28 29
+30 31
+

I prefer planning week by week, as opposed to creating a task-list +every day, here’s what I have for the first couple of weeks:

+
    January 2023
+Mo Tu We Th Fr Sa Su
+                   1
+ 2  3  4  5  6  7  8
+ 9 10 11 12 13 14 15
+16 17 18 19 20 21 22
+23 24 25 26 27 28 29
+30 31
+
+
+week 1
+
+done apply leaves
+done dload boarding pass
+moved reply to dan
+
+
+week 2
+
+todo reply to dan
+todo pack bags
+done travel insurance
+todo weigh luggage
+

I start the week by writing a header and each item that week is +placed on its own line. The items are prefixed with a todo +or a done signifier.

+

Form over function

+

Right off the bat, the signifiers look very noisy, Even more so once +we start introducing variety (I use “event”, “note” and “moved”):

+
week 1
+
+todo apply leaves
+done dload boarding pass
+todo reply to dan
+event fr trip
+note weight 68.6
+

We can clean this up with “abbreviations” +(:h abbreviations):

+
:iabbrev todo ·
+:iabbrev done ×
+

Now, typing this:

+
todo apply leaves
+

Automatically inserts:

+
· apply leaves
+

You can use x and o as well, but +× (U+00D7, MULTIPLICATION SIGN) and · (U+00B7, +MIDDLE DOT) are more … gourmet.

+

The other signifiers I use are:

+
    +
  • - for note
  • +
  • o for event
  • +
  • > for moved.
  • +
+

Nit #2 is the lack of order. We can employ vim to introduce grouping +and sorting. Select the list of entries for this week:

+
vip         " line-wise select inner paragraph
+:'<,'>sort  " the markers '< and '> are automatically inserted,
+            " they mark the start and end of the selection
+

We end up with:

+
week 1
+
+· apply leaves
+· reply to dan
+× dload boarding pass
+

The lines are grouped by their signifiers, segregating todo items +from completed items. Luckily, MIDDLE DOT is lesser than MULTIPLICATION +SIGN, so todo items are placed at the top. The same goes for +o and x symbols, either set of signifiers will +result in the same sorting order.

+

We can shorten this select-paragraph-invoke-sort dance by setting the +formatprg variable:

+
:set formatprg=sort\ -V
+

Now, hitting gqip should automatically group and sort +the items for the week under the cursor, moving todo items to the top. +Finding signifier glyphs that suit your sorting preference is a fun +exercise.

+

Syntax highlighting

+

Adding color to items introduces another layer of visual distinction. +In truth, I like to deck it out just because.

+

First, create a few syntax groups:

+
:syntax match JournalAll /.*/        " captures the entire buffer
+:syntax match JournalDone /^×.*/     " lines containing 'done'  items: ×
+:syntax match JournalTodo /^·.*/     " lines containing 'todo'  items: ·
+:syntax match JournalEvent /^o.*/    " lines containing 'event' items: o
+:syntax match JournalNote /^- .*/    " lines containing 'note'  items: -
+:syntax match JournalMoved /^>.*/    " lines containing 'moved' items: >
+

Add highlights to each group:

+
:highlight JournalAll    ctermfg=12   " bright black
+:highlight JournalDone   ctermfg=12   " bright black
+:highlight JournalEvent  ctermfg=6    " cyan
+:highlight JournalMoved  ctermfg=5    " magenta
+:highlight JournalNote   ctermfg=3    " yellow
+

In my terminal, this is rendered like so:

+

+

Habit tracking

+

While this is not a part of my journaling system anymore, a few +headers and an awk script is all it takes to track habits. My weekly +entries would include a couple of habit headers like so:

+
week 1 --------------
+
+× wake up on time
+× water the plants
+
+spend 7.5 7 10
+---------------------
+
+
+week 2 --------------
+
+· make the bed
+· go to bed
+
+spend 30 2.75 6
+---------------------
+

Here, under the spend header in week 1, are a list of +expenditures accumulated over the week. The monthly spend is calculated +with this awk script:

+
BEGIN {spend=0;}
+/spend/ {for(i=1;i<=$NF;i++) spend+=$i;}
+END { printf spend "eur"}
+

And invoked like so:

+
λ awk -f spend.awk journal/2023/01
+63.25eur
+

Reflection

+

Journaling is not just about planning what is to come, but also +reflecting on what has passed. It would make sense to simultaneously +look at the past few weeks’ entries while making your current one. To +open multiple months of entries at the same time:

+
λ vim -O journal/2023/0{1,2,3}
+

Opens 3 months, side-by-side, in vertical splits:

+
JANUARY ------------  │  FEBRUARY -----------  │  MARCH --------------
+                      │                        │
+Mo Tu We Th Fr Sa Su  │  Mo Tu We Th Fr Sa Su  │  Mo Tu We Th Fr Sa Su
+                   1  │         1  2  3  4  5  │         1  2  3  4  5
+ 2  3  4  5  6  7  8  │   6  7  8  9 10 11 12  │   6  7  8  9 10 11 12
+ 9 10 11 12 13 14 15  │  13 14 15 16 17 18 19  │  13 14 15 16 17 18 19
+16 17 18 19 20 21 22  │  20 21 22 23 24 25 26  │  20 21 22 23 24 25 26
+23 24 25 26 27 28 29  │  27 28                 │  27 28 29 30 31
+30 31                 │                        │
+                      │                        │
+                      │                        │
+WEEK 1 -------------  │  WEEK 1 -------------  │  WEEK 1 -------------
+                      │                        │
+> latex setup         │  > forex               │  - weight: 64
+× make the bed        │  × clean shoes         │  > close sg-pr
+× 03: dentist         │  × buy clothes         │  × facewash
+× integrate tsg       │  × draw                │  × groceries
+                      │                        │
+                      │                        │
+WEEK 2 -------------  │  WEEK 2 -------------  │  WEEK 2 -------------
+                      │                        │
+× latex setup         │  - viral fever         │  > close sg-pr
+× send invoice        │  × forex               │  × plan meet
+× stack-graph pr      │  × activate sim        │  × sg storage
+                      │  × bitlbee             │
+

Reducing friction

+

Journaling already requires a solid amount of discipline and +consistency. The added friction of typing +vim journal/$CURRENT_YEAR/$CURRENT_MONTH each time is doing +no favors.

+

To open the current month based on system time:

+
λ vim $(date +"%Y/%m")
+

To open all the months within a 2 month window of today, is a little +trickier. The command we wish to generate is (if today is 2023/12):

+
λ vim -O 2023/10 2023/11 2023/12 2024/01 2024/02
+

And that is where dateseq from dateutils comes in handy, for +example:

+
λ dateseq 2012-02-01 2012-03-01
+2012-02-01
+2012-02-02
+2012-02-03
+...
+2012-02-28
+2012-02-29
+2012-03-01
+

This script opens all months within a 2 month window of today:

+
λ vim -O $(
+  dateseq \
+      "$(date --date "2 months ago" +%Y/%m)" \
+      "$(date --date "2 months" +%Y/%m)" \
+      -i %Y/%m \
+      -f %Y/%m
+)
+

Fin

+

You can find a sample vimrc file here: cli/journal, along with +a nix flake file to kick things off.

+

Plain text journaling can be just as much fun as a pen and paper. +Throw in some ASCII art for each month, use swankier signifiers, or +louder syntax highlighting. Don’t expect forgiveness from org-mode users +though.

+

+ +
+ +
+ Hi. + +

I'm Akshay, programmer and pixel-artist.

+

+ I write open-source stuff to pass time. + I also design fonts: + scientifica, + curie. +

+

Send me a mail at nerdy@peppe.rs or a message at nerdypepper@irc.rizon.net.

+
+ + Home + / + Posts + / + Plain Text Journaling + View Raw +
+
+ + diff --git a/posts/plain_text_journaling.md b/posts/plain_text_journaling.md new file mode 100644 index 0000000..b1e2908 --- /dev/null +++ b/posts/plain_text_journaling.md @@ -0,0 +1,347 @@ +I cobbled together a journaling system with {neo,}vim, +coreutils and [dateutils](http://www.fresse.org/dateutils). +This system is loosely based on [Ryder +Caroll's](https://www.rydercarroll.com/) Bullet Journal +method. + +[![](https://u.peppe.rs/SpF.png)](https://u.peppe.rs/SpF.png) + +### The format + +The journal for a given year is a directory: + +```bash +λ ls journal/ +2022/ 2023/ +``` + +In each directory are 12 files, one for each month of the +year, numbered like so: + +```bash +λ ls journal/2023/ +01 02 03 04 05 06 07 08 09 10 11 12 +``` + +We can now begin writing stuff down: + +```bash +λ vim journal/2023/1 +``` + +Every month must start with a calendar of course, fill that +in with: + +```vim +:read !cal -m +``` + +Your entry for January might look like this: + +```bash +λ cat journal/2023/01 + January 2023 +Mo Tu We Th Fr Sa Su + 1 + 2 3 4 5 6 7 8 + 9 10 11 12 13 14 15 +16 17 18 19 20 21 22 +23 24 25 26 27 28 29 +30 31 +``` + +I prefer planning week by week, as opposed to creating a +task-list every day, here's what I have for the first couple +of weeks: + +``` + January 2023 +Mo Tu We Th Fr Sa Su + 1 + 2 3 4 5 6 7 8 + 9 10 11 12 13 14 15 +16 17 18 19 20 21 22 +23 24 25 26 27 28 29 +30 31 + + +week 1 + +done apply leaves +done dload boarding pass +moved reply to dan + + +week 2 + +todo reply to dan +todo pack bags +done travel insurance +todo weigh luggage +``` + +I start the week by writing a header and each item that week +is placed on its own line. The items are prefixed with a +`todo` or a `done` signifier. + + +### Form over function + +Right off the bat, the signifiers look very noisy, Even more +so once we start introducing variety (I use "event", "note" +and "moved"): + +``` +week 1 + +todo apply leaves +done dload boarding pass +todo reply to dan +event fr trip +note weight 68.6 +``` + +We can clean this up with "abbreviations" (`:h abbreviations`): + +```vim +:iabbrev todo · +:iabbrev done × +``` + +Now, typing this: + +``` +todo apply leaves +``` + +Automatically inserts: + +``` +· apply leaves +``` + +You can use `x` and `o` as well, but `×` (U+00D7, +MULTIPLICATION SIGN) and `·` (U+00B7, MIDDLE DOT) are more +... *gourmet*. + +The other signifiers I use are: + +- `-` for note +- `o` for event +- `>` for moved. + +Nit #2 is the lack of order. We can employ vim to introduce +grouping and sorting. Select the list of entries for this +week: + +```vim +vip " line-wise select inner paragraph +:'<,'>sort " the markers '< and '> are automatically inserted, + " they mark the start and end of the selection +``` + +We end up with: + +``` +week 1 + +· apply leaves +· reply to dan +× dload boarding pass +``` + +The lines are grouped by their signifiers, segregating todo +items from completed items. Luckily, MIDDLE DOT is lesser +than MULTIPLICATION SIGN, so todo items are placed at the +top. The same goes for `o` and `x` symbols, either set of +signifiers will result in the same sorting order. + +We can shorten this select-paragraph-invoke-sort dance by +setting the `formatprg` variable: + +```vim +:set formatprg=sort\ -V +``` + +Now, hitting `gqip` should automatically group and sort the +items for the week under the cursor, moving todo items to +the top. Finding signifier glyphs that suit your sorting +preference is a fun exercise. + +### Syntax highlighting + +Adding color to items introduces another layer of visual +distinction. In truth, I like to deck it out just because. + +First, create a few syntax groups: + +```vim +:syntax match JournalAll /.*/ " captures the entire buffer +:syntax match JournalDone /^×.*/ " lines containing 'done' items: × +:syntax match JournalTodo /^·.*/ " lines containing 'todo' items: · +:syntax match JournalEvent /^o.*/ " lines containing 'event' items: o +:syntax match JournalNote /^- .*/ " lines containing 'note' items: - +:syntax match JournalMoved /^>.*/ " lines containing 'moved' items: > +``` + +Add highlights to each group: + +```vim +:highlight JournalAll ctermfg=12 " bright black +:highlight JournalDone ctermfg=12 " bright black +:highlight JournalEvent ctermfg=6 " cyan +:highlight JournalMoved ctermfg=5 " magenta +:highlight JournalNote ctermfg=3 " yellow +``` + +In my terminal, this is rendered like so: + +[![](https://u.peppe.rs/Du6.png)](https://u.peppe.rs/Du6.png) + +### Habit tracking + +While this is not a part of my journaling system anymore, a +few headers and an awk script is all it takes to track +habits. My weekly entries would include a couple of habit +headers like so: + +``` +week 1 -------------- + +× wake up on time +× water the plants + +spend 7.5 7 10 +--------------------- + + +week 2 -------------- + +· make the bed +· go to bed + +spend 30 2.75 6 +--------------------- +``` + +Here, under the `spend` header in week 1, are a list of +expenditures accumulated over the week. The monthly spend is +calculated with this awk script: + +```awk +BEGIN {spend=0;} +/spend/ {for(i=1;i<=$NF;i++) spend+=$i;} +END { printf spend "eur"} +``` + +And invoked like so: + +``` +λ awk -f spend.awk journal/2023/01 +63.25eur +``` + +### Reflection + +Journaling is not just about planning what is to come, but +also reflecting on what has passed. It would make sense to +simultaneously look at the past few weeks' entries while +making your current one. To open multiple months of entries +at the same time: + +``` +λ vim -O journal/2023/0{1,2,3} +``` + +Opens 3 months, side-by-side, in vertical splits: + +``` +JANUARY ------------ │ FEBRUARY ----------- │ MARCH -------------- + │ │ +Mo Tu We Th Fr Sa Su │ Mo Tu We Th Fr Sa Su │ Mo Tu We Th Fr Sa Su + 1 │ 1 2 3 4 5 │ 1 2 3 4 5 + 2 3 4 5 6 7 8 │ 6 7 8 9 10 11 12 │ 6 7 8 9 10 11 12 + 9 10 11 12 13 14 15 │ 13 14 15 16 17 18 19 │ 13 14 15 16 17 18 19 +16 17 18 19 20 21 22 │ 20 21 22 23 24 25 26 │ 20 21 22 23 24 25 26 +23 24 25 26 27 28 29 │ 27 28 │ 27 28 29 30 31 +30 31 │ │ + │ │ + │ │ +WEEK 1 ------------- │ WEEK 1 ------------- │ WEEK 1 ------------- + │ │ +> latex setup │ > forex │ - weight: 64 +× make the bed │ × clean shoes │ > close sg-pr +× 03: dentist │ × buy clothes │ × facewash +× integrate tsg │ × draw │ × groceries + │ │ + │ │ +WEEK 2 ------------- │ WEEK 2 ------------- │ WEEK 2 ------------- + │ │ +× latex setup │ - viral fever │ > close sg-pr +× send invoice │ × forex │ × plan meet +× stack-graph pr │ × activate sim │ × sg storage + │ × bitlbee │ +``` + +### Reducing friction + +Journaling already requires a solid amount of discipline and +consistency. The added friction of typing `vim +journal/$CURRENT_YEAR/$CURRENT_MONTH` each time is doing no +favors. + +To open the current month based on system time: + +```bash +λ vim $(date +"%Y/%m") +``` + +To open all the months within a 2 month window of today, is +a little trickier. The command we wish to generate is (if +today is 2023/12): + +```bash +λ vim -O 2023/10 2023/11 2023/12 2024/01 2024/02 +``` + +And that is where `dateseq` from +[dateutils](http://www.fresse.org/dateutils) comes in handy, +for example: + +```bash +λ dateseq 2012-02-01 2012-03-01 +2012-02-01 +2012-02-02 +2012-02-03 +... +2012-02-28 +2012-02-29 +2012-03-01 +``` + +This script opens all months within a 2 month window of +today: + +```bash +λ vim -O $( + dateseq \ + "$(date --date "2 months ago" +%Y/%m)" \ + "$(date --date "2 months" +%Y/%m)" \ + -i %Y/%m \ + -f %Y/%m +) +``` + + +### Fin + +You can find a sample vimrc file here: +[cli/journal](https://git.peppe.rs/cli/journal/tree), along +with a nix flake file to kick things off. + +Plain text journaling can be just as much fun as a pen and +paper. Throw in some ASCII art for each month, use swankier +signifiers, or louder syntax highlighting. Don't expect +forgiveness from org-mode users though. + +[![](https://u.peppe.rs/ZCK.png)](https://u.peppe.rs/ZCK.png) -- cgit v1.2.3