Enjoying Open Source Software

Zettelkasten in plain text-only flat files

Zettelkasten: build up knowledge and insights

A Zettelkasten is a great system to build up your knowledge, ideas and insights.

People have been using Zettelkasten from at least the seventeenth century, so for more than 300 years.

The name Zettelkasten is German for cabinet ("Kasten") with index cards ("Zettel").

The modern use of Zettelkasten is mainly focused on the writing of scientific books, papers and articles, but Zettelkasten is also useful outside the scientific world, for the personal development of knowledge, ideas and insights.

Zettelkasten: a long term project

Building a Zettelkasten is an investment for the future.

A Zettelkasten starts working when it contains some critical mass. There needs to be enough Zettel, with enough ideas and enough cross references, before it starts to really work.

Zettelkasten therefor gain value over time, typically one or more decades.

What ever the system you choose to implement your Zettelkasten in, be sure it will survive that long and still is available and useful in, say, ten or twenty years.

Avoid proprietary formats

Today, nobody uses the WordPerfect 5.1 format anymore. Microsoft Office has superseded Wordperfect and replaced the common used format with its doc-format, which was later abandoned and replaced with the docx-format (pretending that it is an open format).

Who knows what formats will be used in ten or twenty years? How sure are you, that the proprietary formats you are using today, will be available and usable in the next decades?

So, to be sure of a sustainable Zettelkasten you should avoid proprietary formats.

Avoid external services

Cloud services come and go.

Google have shown that even successful and popular cloud services, provided by a large company, can be terminated at any time.

New and innovative cloud services are often created and maintained by a small team, with even less guarantees for the long term availability of those services.

How much can you trust a cloud services?

Even when you trust the current owner of the cloud service, tomorrow it can be sold to another party.

Microsoft, the current owner of GitHub, have shown that all the data you put into a cloud service, can be harvested and used for the benefit of the owner of the cloud service, without respect for the intellectual property --and without any opt-out option for the users.

Who knows, what the current or future owner of the cloud service you build your Zettelkasten in, will do with all your valuable data?

So, to be sure of a sustainable Zettelkasten you should avoid cloud services and any other dependency on external sources as much as possible.

Zettelkasten: low tech

Simplicity is often the best

Over the last hundreds of years many successful Zettelkasten have been build with real paper "Zettel" (index cards) with hand written cross-references.

The added value from the Zettelkasten comes from your interlinked permanent notes in which you explain certain ideas to your future self.

When you create a Zettel, you have first investigated the subject, and made sure you understood it. After this, you write an explanation in your own words to your future self.

At creation time you also search for one or more related Zettel and connect the Zettel with cross-references, links from one Zettel to another, completed with back links on the referring Zettel.

When your Zettelkasten grows, the links between the notes, and therefor, the links between ideas, can lead to surprising new insights.

It is not about the technology

While there are many advantages in bringing the Zettelkasten in the digital realm, we should be careful not to over complicate things.

You must be in full control over your Zettelkasten and understand its internal workings. The more complex the system is, the more it becomes a black box that seems to do magical things beyond your understanding and beyond your control.

Wiki with back links

Basically, the functionality of a digital Zettelkasten is like the functionality of a wiki with back links and tags.

It is not the complex technology that makes your Zettelkasten valuable, but the information you put into it, how you compiled that information and the links you created between the ideas.

Plain text files

Best long term format

Flat, plain text files are the best long term format.

Flat, plain text files were readable in the sixties, and will still be readable in twenty or thirty years.

Version control

Version control systems love flat, plain text files. They are made for this format. So when your Zettelkasten uses plain text files it is very easy to put these under your favorite version control, with all the benefits that comes from version control systems.

All elements should be in plain text

You choose flat, plain text files because of the digital sustainability. For the same reason, your Zettelkasten should use only plain text files, and nothing else.

So, no databases that magically create back links, but links and back links right in the plain text files self.

CamelCase filenames

In the heydays of the wiki, the CamelCase format was king. Everybody could understand CamelCase, it is easy to type and requires no remembering of link formats.

For humans, it is easy to pick out CamelCase words in a text.

Also for digital processing CamelCase is fine, it constitutes a pattern that can be matched with a simple regular expression (regexp).

The wonderful lightweight awkiawki wiki for example, written in awk, uses a regexp to recognize CamelCase an create a hyperlink from it on the fly. Likewise, you can build Perl-scripts, Vim-scripts, Python-scripts, and so on, to work with CamelCase.

So, when you use CamelCase to create your links from one Zettel to another, as well as the back links, you keep your Zettelkasten in plain text files in a sustainable format.

Meaningful filenames

An advantage to use CamelCase for your filenames is that you get readable filenames.

Some Zettelkasten systems use a timestamp for the filename, as a method to generate unique filenames.

When you choose CamelCase words as filename, theoretically there is a chance of filename collision, meaning that you could choose a CamelCase word that is already in use. My personal awkiawki wiki however, currently contains over 800 files, all with CamelCase words, and this has never been a problem.

Simple editor functions

Traditionally, BSD- and Linux systems provide powerful text editors.

When you use a decent editor, like Emacs or Vim, there is no need for extra tooling, you can just use the build in features of your editor or some minor added functions.

For this, you need two important functions:

  • jump to the file which name is under the cursor, and create if it does not exists yet.
  • copy the filename of the current file to the editor's clipboard

When you want to create a new Zettel, go to the Zettel you want to connect from, and use the second function to copy the filename of that Zettel to the editor's clipboard.

Now write under a heading of related Zettel the CamelCase of your new to create Zettel and use the first function to jump to this file. The editor opens this file in a new window or buffer, creating it if needed.

There you create a heading for the back links, and paste the previous copied filename of the Zettel you jumped from.

Congratulations, you now have two interlinked Zettel.

To wrap it up, each Zettel consists of a file with a CamelCase filename. The Zettel contains a title, your explanation of the idea your Zettel is about, and an area "Related Zettel", with the CamelCase filenames of one or more related Zettel. Just put your cursor over one of those, and use the first function to jump to the related Zettel.


In Emacs, to jump to the file under the point (cursor), you use the "find-file-at-point" function. Unfortunately, this does not works for files that don't exist yet, because it tries to fuzzy-find the file. Maybe you can create your own elisp function for this, it shouldn't be that hard. Perhaps something like this is enough:

(defun my-goto-filename()
  "Visit file under point"
  (find-file (current-word)))

You can also use the org mode links for this, but than you have to use the double square bracket method (like [[MyFileName]] ). This also works in Markdown mode.

To copy the current filename to the kill buffer, you could use a function like:

(defun my-copy-filename ()   
"Copy the filename, without path, of the current buffer."  
(kill-new (file-name-nondirectory (buffer-file-name (window-buffer (minibuffer-selected-window))))))


To jump to the file under the cursor:

  • For existing files: simple type gf in command mode, of, if you want to open it in a different window, use Ctrl-w f.
  • For new or existing files: Use :tabe <cfile>

To copy the current filename, use expand("%:t:r").


It turned out that it was relative easy to create similar functions in Mark Alexander's fork of Conroy's MicroEMACS.

I created a function in pe that opens the file under point (cursor) in a new buffer, and a function that copies the current filename to the kill-ring.

Unfortunately, this version of MicroEMACS only builds on Linux and FreeBSD. I could not successfully compile it on OpenBSD and NetBSD.