Getting Organized with Zim

I am playing with a notes package called Zim. It claims to be wiki-like which makes it pretty interesting.

The usual complaint about Wikis is that the syntax gets in the way. That is, you have to insert syntax (which is usually somewhat different in each Wiki) to get things done. Well, Zim has no syntax or, more accurately, you don't work with it or ever see it. Zim just uses it internally to offer the functionality. While you can't really call it a WYSIWYG, it's close and you don't have to do funny stuff to get the WYSIWYG features.

Did you ever use Wordstar or PCWrite? It is much more like that. While there are menus, you can just type using control sequences to do funny formating. Here are some examples:

  • control-B for bold toggle
  • control-I for italic toggle
  • control-1 for a level 1 heading
  • control-2 for a level 2 heading

These are all optional, of course. And sometimes you will need to use the menu but it is the exception rather than the rule. For example, you need it for a superscript but, seriously, how often do you use that?

That gives you the basic idea of how to enter text. But, there is a lot more including the ability to include figures and documents. That can be done using drag and drop or a mouse click to get a file menu.

Such distracting operations as saving a file are not there. That is, you just type. Files are saved automatically. They are just text files with the markup that Zim needs to know how to display the document. (I wrote this document in Zim.

Wiki Features

A better title might be "features that give you wiki-like functionality". If you appreciate what a Wiki can do but hate having to care how to do it, this seems like a big win. First, let me explain the display a bit.

It is divided into two (or optionally three) areas. There is the main text area and a sidebar on the left showing pages. The optional third area shows attachments.

Should you want to link to a different page, you just enter control-L. A dialog pops up where you enter what you want to link to and what you want it called. But, you don't have to think about this either unless you choose to. For example, if you just type control-L, the word fred framus and hit Enter twice you will see the words "fred framus" in the text in blue. You have created a link and that page is created. It will appear in the left sidebar.

To go to that new page you could click on the link itself or where it appears in the sidebar. But, if you want to avoid mouse clicks, just position the text cursor somewhere in the word and press Enter.

Some Wikis offer namespaces and Zim gives you this same capability but, once again, without having to think about it. Let's say rather than a page named "fred framus", you wanted a page named "framus" in namespace "fred". You would create the link as before (control-L or a mouse click) but enter "fred:framus". (This is where the dialog box comes in handy. It allows you to have the link text appear different from the actual link name/location.)

In the left sidebar, the new namespace will appear with the new page displayed tree-style within it. You can expand or close this tree display with a single click. Internally, Zim created a new subdirectory using the namespace name and a file within it using the part of the link following the colon.

You can switch between pages by following links or clicking on what you want in the left sidebar. Again, no need to save anything--it all just happens.

The web page for the project is zim-wiki.org and, no, I didn't do anything to have Zim recognize that as a URL and make it clickable within Zim. The punchline is that the web site is written using Zim.

Other Features

Finally, there are some plugins (which you don't have to plug in) to add some capabilities. You activate them in a preferences menu. The internal help documentation will give you the details. They include a todo list feature, diagram editor and a spell checker. Rather than try to define them, it is better to play. Stuff that makes sense seems to be there as long as adding it doesn't make it harder to do the "regular stuff".

Note that apparently Zim was initially written in Perl but the current version is in Python. It is amazingly fast. The code is almost 10,000 lines of Python. A quick look at it shows it to be clean and extensively documented. The author uses classes and other/modern Python features such as decorators. My guess is that the code looks very different from the Perl version.

Comments from Others

I received a couple of responses from friends about Zim. Here they are.

Wordstar? That's from 30 years ago. Once we got fancy, GUI WYSIWYG programs to enter text, the race was on. For a casual or occasional user, such fancy tools make sense. But, it each speedcompetition, anything that requires you to remove your hands from the keyboard and use a mouse is a loser.

I already have my favorite editor. I don't want to change. This is pretty much related to the first question. The good news is that Zim doesn't require you to change. You can create text files in your editor and import them into Zim and you can even edit Zim files with your favorite editor.

Comments

Bulleted lists

I realized that about the only time I needed to use the mouse was to create a bulleted list so I decided to ask for a feature. Well, I now know that even if Zim is trivial to learn/use, RTFM.

It turns out, if you just start a line with asterisk followed by space, you get a bulleted list. I'ts like magic. :-)

Note that the author asked for suggestions to make the documentation better. My first thought was that there were no documentation issues involved -- the real problem was that Zim is just so intuitive it discourages you from reading the documentation.

Encrypted Zim files

I continue to really like Zim/use it all the time. One of the things I continue to use Dokuwiki for is saving secret information such as web site passwords. It runs on a local server that I access over https. It's only as secure as access to the server but being physically under my control, it is good enough.

I was thinking, is there a way Zim could handle this task as well? The answer is yes. By using EncFS, it becomes easy. For those not familiar with EncFS, it is a user-side way to have a directory and its contents encrypted. That is, no need to have root access and you can pick a file/directory you want to encrypt. You just mount it, use it and unmount it.

For Zim, the operation can be transparent. A simple shell script can mount the encrypted filesystem prompting for the passphrase and invoke Zim. When you exit Zim, the script can then unmount the encrypted filesystem.

As for access to the data from multiple computers, Unison or some other remote sync mechanism could be used. Zim could also be run remotely over ssh but the remote machine would have to be Internet connected and the data would be available on it unencrypted during the Zim session.

Zim after a week

I have spent a week working with Zim. It is not that I have gone out of my way to use it. It is quite the opposite. Each time I go to scribble something down, Zim jumps out as the right tool. The fact that pages just magically gets created and you never need to think about saving them makes it the default tool of choice.

Pre-Zim, whenever I wanted to scribble something down I would bring up a console, find or create an appropriate directory and and start up my favorite editor (which means vi). Then, the next time I was looking for the information, I would have to go shopping for where I put it.

With Zim I just bring it up (it is usually running and I just have to switch to it but even if it wasn't it is trivial to start and it knows where things are) a nd start typing. Worst case, I need to do a couple of clicks and possibly create a link to get an appropriate new page to work with.

If a page I created in Zim needs to moved, it can be done using Zim's move command which will automatically fix any links. If it needs some serious editing (such as replacing all accourances of foo with bar), it is just a text file and vi can easily handle that for me.

I have also used Zim's ability to export to HTML and, indirectly, to a PDF. This has made it easy to share some of the stuff I have written.