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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
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)
|