A minimal set of tools to manage a plain-text Zettelkasten 1 from the command line.
Dependencies:
- Python 3.8+
- nvim
- fzf
Set the following in your shell:
export ZETTELKASTEN_SOURCE=/path/to/zettelkasten
source $ZETTELKASTEN_SOURCE/bin/aliases.sh
export PATH=${PATH}:$ZETTELKASTEN_SOURCE/bin
zn / foo # creates `1-foo.md`
zn / bar # creates `2-bar.md`
zn 1 another thought # creates `1a-another-thought.md`
zl
Opens fzf
with the following structure:
07-20 1 foo
1a another thought
2 bar
Hit enter
to select a file and then:
- print the filename with
zp
- copy the filename with
zc
- open the file with
zv
Moving entails both:
- renaming the file
- rewriting all references to it
For example:
echo "a link to file 2-bar.md" >> 1a-another-thought.md
Move the file:
zm 2-bar.md 1a1-bar.md
New hierarchy:
07-20 1 foo
1a another thought
1a1 bar
The reference in 1a-another-thought.md is updated:
a link to file 1a1-bar.md
Filenames have the following structure:
12a1-TAG1-TAG2-a-short-description-of-topic-A.md
^ ^
UID TAGS ^ DESCRIPTION
Tags preface the description and are all-caps.
Per usual practice, the UID consists of alternating numbers and characters.
Given the following files:
# Created on 07-20:
zn / foo
zn / bar
# Created on 07-21:
zn 1 another thought
zn / SHAPES 2d
zn 3-SHAPES-2d.md triangle
zn 3a equilateral
zn 3a scalene
zn 3 quadrilateral
The list (zl
) will be shown as:
07-20 1 foo
07-21 1a another thought
07-20 2 bar
07-21 3 SHAPES 2d
3a triangle
3a1 equilateral
3a2 scalene
3b quadrilateral
The list can be ordered by last updated time with ctrl-l
:
07-20 1 foo
2 bar
07-21 1a another thought
3 SHAPES 2d
3a triangle
3a1 equilateral
3a2 scalene
3b quadrilateral
Switch back to order-by-name with ctrl-n
.
zn
: new filezl
: list fileszm
: move file and update referenceszg
: grep fileszp
: print the previous file created/chosenzc
: copy --''--zv
: open in vim the previous file created/chosen