Thursday, 9 August 2012

Confessions of a Vim geek

Ok, so I tried to stay out of the editor wars, I went so far as to write my own text editor! I was sure I'd never have to touch vi beyond that damn annoying visudo command and in University I had a really bad experience experience with Emacs, and I haven't touched it again since. I saw no need to look into either text editor.

However I started a new job back in March and had to use a 'real' text editor so it was either Emacs or vi.

When the flashbacks were over and I'd stopped twitching, I looked at Vim as my editor of choice, I wont use Emacs if I can avoid it. Period!

It was rather overwhelming at first, I resented the fact I had to use an editor that were so old, ugly looking and confusing.

As I begun to use it in my daily work, I thought I was experiencing Stockholm syndrome or something because I quickly began to notice a change, it was small things at first, I instantly went to "esc:w" to save documents in Word and in Firefox I hit "/" to google anything, it was like a perverted digital infection that was getting inside my head.I found myself doing things the Vim way, almost naturally.

It came to a turning point when I needed to remove the Windows end of line character on a Linux machine (when the hell will we have this fixed?), I can't remember the specifics, it was in the days before I believed, as many of you do, before my eyes were opened.

It was insane, but it was a varient on the ":%s/\^M//gc" or something like that, it was like magic, dark, secret, arcane magic and it was mine.

The power of Vim comes from it's complext command system, oh that and scripts...

Scripts are the beginning of the downward spiral for me, give me infinate ways to customize something and I will be unable to make it perfect, close to, but not absolutely perfect, but this is where I reveal my perfectionist nature. There is a script for basically anything one might want to do, you can download them all from here. Some work well, others don't, your millage will vary.

It's definately not a friendly text editor, I'm still learning the basics, the hjkl navigation thing is the hard thing to keep my hands in the right place. Twenty odd years of muscle memory of using the arrow keys or wasd will make a transition hard, but ultimately worth it. There is a certain amount of determination and work that has to go into learning Vi(m), like any skill you get back what you put in. I don't know that I would have taken to it so quickly, had I not had someone in the office on hand to help me learn Vim.

There was certinly a lot of customizing work I had to do to the editor to get myself comfortable with it. It was like getting a new chair and having to work that you sized groove into it, I'm still working the groove in because there's some scripts I installed and need to remove and likewise I've found some nice themes, but I will need to adjust them a bit, but it'll get there.

If you haven't used Vim before it's worth giving it a shot if you have need of a text editor, however the text editor is an unusual piece of software largely relegated to hardcore programmers, however I would argue that this recent trend for distraction free writing environments could do worse than use Vim as a base.

All in all my journey so far has been fun and I am still learning and truthfully I wish I'd learned it earlier.

No comments:

Post a Comment