Thursday, July 31, 2008

crontab: temp file must be edited in place

This is an error message I ran into after upgrading vim from 7.0 to 7.1, after editing a crontab file:

  crontab: temp file must be edited in place

What was weird is this error message went away if I deleted my ~/.vimrc file. If ~/.vimrc was blank, the error message was still there, so it wasn’t caused by any command in particular.

It turned out to have something to do with vim’s backup strategy. I am supposing there is a default vimrc file somewhere that gets loaded if ~/.vimrc doesn’t exist.

After some googling, I fixed it by adding the following to my ~/.vimrc file:

  set backupskip=/tmp/*,/private/tmp/*" 

VIM already defaulted this value to ”/tmp/”. I don’t know why defining my own .vimrc made vim not recognize /private/tmp/ as a temp directory any more, but I don’t care enough to find out right now.

Tuesday, July 22, 2008

VIM rocks at Textile

OK, so I am enamorated with VIM!

It so turns out editing Textile in VIM is quite awesome. Put your cursor over “h1.”, press CTRL-a, and whazam: you get “h2.” . If you use the surround.vim1 plugin, and want to bold the last three words: ‘v3bs∗’ (start selecting text, back three words, surround with ∗). If you want to turn 3 words into a link: v3es”f”a: Convert a series of lines (single spaced) into a list: <Ctrl-v>}I∗<Space><Esc>.

What is VIM lacking then? Well, how about Textile highlighting and a command to quickly preview or render your Textile you may say? Good thing there’s a TOTALLY AWESOME PLUGIN (shameless plug) for VIM to make that a thing of yesteryear!

And Now, Ladies and Gentlement, I Bring You:

Textile for VIM – Fun for the whole family!


  • Syntax highlighting (Thanks to the work of two very cool dudes, Dominic Mitchell and Aaron Bieber)
  • Preview Textile (\tp – whamo! See texile rendered in your browser! No need to save your file first)
  • Render Textile (\tr – open a new VIM tab with the rendered HTML, so you can paste it into your favorite blogging software that doesn’t support Textile, like Blogger, for example)
  • Render Textile to a file! (\tf)

1. if you use VIM and don’t have surround.vim installed, you really should DROP EVERYTHING and go install it

The vertical climb to VIM

A good friend of mine posted an article that finally inspired me to learn another editor (even though I was, and still am, quite happy with TextMate).

What resulted was a direct vertical climb up the the learning curve of VIM:

And, painful it was! There were times when I felt obligated to keep using it, even though I longed for the simpicity of TextEdit or TextMate. Why did I do it? Well, when I learned how to chain commands together I was addicted! And then there was finding out that VIM does all the things I’ve wanted an editor to do for a long time.

A few of the features I love:

  • Ability to chain commands together (d3w, di”, c/Word, g~e etc)
  • Visual block mode
  • VIM plugins
  • Complete from words in doc
  • Lots of navigation keys to get you precisely where you want to be in less than 3 key strokes
  • VIM follows me everywhere – Desktop, terminal, linux, unix, windows, OS X)
  • Multiple registers (clipboards)
  • Macros
  • The ”.” key (repeat last edit)
  • Many more

I now really fancy this old-timer VIM, and as my friend described, I can shovel around text by the shovel-full. It’s an amazing feeling! I still feel all warm inside and excited when I go to edit a bunch of text and get to hop around, move stuff around, make spelling corrections, all without moving my hands off the middle of the keyboard!