Published by Niels on 02 Aug 2006 at 09:29 am
NanoBlogger and ViM
NanoBlogger is a minimalistic approach to blogging as vi (or ViM) is a minimalistic approach to editing. Okay, not as minimalistic as ed or ex, but you get the idea.
Using ViM as the default editor for NanoBlogger is as simple as setting the variable $EDITOR in .bashrc, $BLOG_DIR/blog.conf or, if you want control of NanoBlogger settings for each machine that you work on, $HOME/.nb.conf.
But the default settings for editing entries or articles are not particularly nice. Fortunately ViM can have settings on a per-file basis using modelines (if you don’t know what they are just type :h auto-setting on the ViM command line). To make editing with ViM a bit nicer, just edit the following files:
$BLOG_DIR/templates/entry.metadata$BLOG_DIR/templates/file.metadata
and add the following line at the end of the file:
vim: set ts=4 sw=4 ff=unix fo+=t et:
This should provide you with some decent ViM settings across all machines that you are working on.
WARNING:
NanoBlogger versions <=3.3-RC5 have a bug that will overwrite the template files with the default template files and undo your modeline setting. This can be fixed by either using a later version (not available at the time of this writing), using the CVS version or editing the file lib/tools.sh in the same directory where your NanoBlogger binary is. Search for a line that has the following:
$NB_TEMPLATE_DI/
and change that to:
$NB_TEMPLATE_DIR/