Andrew Woods Seattle Web Developer

My .vimrc

One of my main text editors is vim, which comes pre-installed on every mac and linux distro. It can be a pain to create a .vimrc file, so i thought i’d share mine with you. I’m a web developer that writes mostly php, so I’ve a couple of tricks at the bottom to help with things i do a lot.

One thing is commenting my code. Sometimes I want to write a comment on a single line but use the /* and */ syntax. This works for both PHP and CSS. When I’m in insert mode, I’ll go a new line and type scom. I have an abbreviation set up that writes the comment characters AND moves the cursor back a few characters, so I can type the text of the comment. Pretty cool, eh?

You can download my vimrc file. It should be put into your $HOME directory and renamed to .vimrc.

Convert Line Endings In Textmate

Goto Text > Filter Through Command

Menu in Textmate "Text -> Filter Through Command"
  • Set Input to “Document”
  • Set Output to “Replace Document”
  • Use this sed one-liner as your command to convert from Unix to DOS:
sed "s/$/`echo -e \\\r`/"
Screenshot of "Filter through command" dialog in Textmate

Convert line endings from Unix to Dos using Sed in Textmate for current document