Tuesday, November 02, 2004

Vim and Subversion as a CMS

web :: software


Like nearly everyone on the planet who has ever had to write
HTML, I abhore it. When I started working for the University of
Maryland as a developer in 1998, I learned to hate it more than ever. I
has responsible for multiple, complex sites, all with regularly
changing content. Maintaining all that HTML was a nightmare.



A few months later, I discovered Zope and began my long love affair
with Python and an abiding interest in Content Management Systems. Yet,
all the "long" years (1 human year is 7 years in software ;-) ) since
then, there hasn't been a great deal of progress with open source CMSs.
Sure, there has been a great deal of refinement and improvement in user
interface, in feature sets, etc., but when it comes right down to it,
what does it mean?




I started my search for a CMS at UMCP because I need to save time
more than anything else. I needed a way to easily edit files, to not
have to play browser compatibility wars with every change to the site,
to easily generate new content.



For large, complex sites, I now use Zope and Plone, especially when
customers will need to manage their own content. However, I have found
that through a combination of simple technologies, I can acheive all
the speed and convenience I have ever needed without any of the tedium
-- including HTML.



I have many friends who are emacs lovers, and I have heard all the
arguments, yet I have been a vi/vim user for many years and do not ever
see that changing. Additionally, I am a huge fan of python and the
software version control system called Subversion. These three things
have become merged into a seamless CMS that fits many of my content
management needs.



Here are the components that I use:



* HTML templates

* Ini-style config files for menus, stories, and other content (very easy to create/update)

* Very simple python code to apply the content to templates and render HTML output

* Subversion to manage site changes, versions, rollbacks, etc.

* vim as a command-line tool to manage the content



The thing that really did it for me was a feature of vim I had never
played with until recently: windows. Windows in vim are panes. they can
be arranged vertically, horizontally, or any combination. They are easy
to create (:vne, :new) and easy to maniuplate (^xw, etc.). I typically
have 4-5 panes in a single terminal window open at any given time, and
I can access all the buffers in any pane. This means that I can compare
two python libraries side-by-side, edit the project web site (all in
ini-file format!), update the ChangeLog and add to the TODO file all
without haveing to change mental modes.



And that's the big key and biggest show stopper for any software
from a user perspective: does the tool you use cost you time in mental
adjustment while operating the standard tools of your trade? If so,
it's time to re-evaluate.



For me, I discovered that I was saving time. Huge chunks of lost
time were regained and I was able to start doing many more tasks
simultaneously, since I didn't have to shift mental modes. I have an
irc session open on the development channel, an interactive python
session for debugging and generating doc tests, and my ultra-vim
terminal for code and content.



It's a beautiful thing.



I did try to run interactive python sessions in vim -- and with
success, too. A very nice plugin called vimsh developed by Brian Sturk.
However, I found that this actually slowed me down, so I switched back
to an independant terminal window.



I guess the moral of the story is explore and don't listen to The Man; use the tool that's best for you ;-)


No comments:

Post a Comment