The Zen of Wiki with Gollum

I’ve always loved wikis. They are very useful for bookmarks and snippets. After many years of Dokuwiki, I switched to Gollum for these reasons:

  • I can use Vim to edit my wiki pages.
  • I can use Ack for searching.
  • I can read/edit it on Github, when I’m not on my MacBook.

Setup

Create a repository in Github (I use the repository of my blog). Click wikiGit Access. Clone the wiki and you are done.

Edit

If you want to edit your wiki in Chrome with Gollum, read this article. If you prefer to use Vim, I suggest you to install these plugins with Vundle:

1
2
3
4
5
6
" open links in chrome
Bundle 'tyru/open-browser.vim'
" syntax highlight
Bundle 'tpope/vim-markdown'
" follow internal links of the wiki
Bundle 'mmai/wikilink'

Reloadlive

If you want to see the wiki page rendered in your browser while you are writing it, I have written a gem called Reloadlive.

1
2
3
$ gem install reloadlive
# inside the directory of gollum
$ reloadlive

Reloadlive demo

Sync

It’s very boring to do every time you modify your wiki:

1
2
3
4
git pull
git add -A
git commit -m "minor changes"
git push

But if you use Rvm, you can create a .rvmrc in the root of your wiki:

1
2
3
4
# .rvmrc
if [[ $- == *i* ]] # check for interactive shells
then git pull && git add -A && git commit -m "minor changes" && git push
fi

Every time you cd, Rvm looks for a file called .rvmrc. If it finds it, it executes it. If you don’t use Rvm, you can use Autoenv.

1
2
# alias to sync when you are already in the root of the wiki.
alias gsync="sh ./.rvmrc"

Conclusion

  • No database.
  • Password protected if you need.
  • Distribuited.
  • Autosync.
  • It works offline.
  • Vim editing instead of the textarea.
  • Regex search with Ack.
  • Instant preview in the browser.
  • Markdown language like in Jekyll.

I’m ok for the next 10 years. :-)

Comments