Skip to main content

Vim Knowledge Management

Another installment of @hyde's "Vim Carnival", this time asking, "How do you use Neovim/Vim to build your knowledge management?"

Unstructured Data

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

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.

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

I also have a keyboard shortcut in my window-manager (Fluxbox) to launch a shell-script that uses zenity to prompt me for a description, then appends the current date+time, the one-line description, and the contents of the clipboard (using xsel) to this file.

Structured Data

Depending on the nature of the structured usually specific tooling gets used to manipulate it.

Address book

I keep my personal address book in GNU RecUtils format. This plain-text database format easily lets me add new fields as I have need.

# 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
a sample addressbook.txt excerpt

Most of the time, I find it easiest to just open the file in my $EDITOR 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.

Calendar

I use Remind for calendar-related data. Thanks to recsel and a little awk scripting, I can generate remind entries for birthdays, anniversaries, adoptions, memorials, etc. Then remind can INCLUDE the resulting files.

For other appointments, they go directly into the corresponding reminder files &emdash; 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, …

I have a cron job that sends each day's remind output to my email, so I have a copy of the day's reminders and todo items.

Finances

I track these as plain-text accounting plain-text which allows me to manage my finances using ledger.

Todos

For a long time I kept todo items in todo.txt format, and had a symlink for my ~/.plan so I could use finger(1) from other machines to fetch my current todo list.

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

Closing

But the best part of all of this? It's all plain text. I store it in git and can edit it with any editor, whether vim, vi, ed(1), or even (as noted above) generated by shell commands.


If interested, here's the shell-script

#!/bin/sh
SAVE_FILE="$HOME/notes.txt"
DESC="$(zenity --title 'Enter description' --entry --text 'Enter description of clipboard contents')"
if [ -n "${DESC}" ]
then
 echo  $SAVE_FILE
 date +"%Y-%m-%d %H:%M"  $SAVE_FILE
 echo "${DESC}"  $SAVE_FILE
 xclip -o -selection clipboard  $SAVE_FILE
 echo  $SAVE_FILE
fi