My Vim Setup

I’ve been using Vim as my main editor for well over two years now. After having used many editors in the past (from full blown IDEs like Eclipse and NetBeans, to simpler editors like TextMate), I’ve found my perfect match. It’s ubiquity and openness are winners (I’d be disheartened right now if I was using abandonware like TextMate) and the modal editing is exactly right for how I work (I wish every text area had modal editing!)

How have I tailored my Vim setup?
  • The biggest factor has been changing to use Tim Pope’s Pathogen.vim plugin recently. It allows you to keep your plugins separate in their own directories, which of course makes upgrading and managing them far, far easier.
  • I also rely on VimWiki. It gives me a personal wiki (I store the actual files on DropBox) which I can access almost anywhere (and importantly, cross platform), but get to edit with all of the benefits of Vim. Prior to VimWiki I had unhappily bounced around between Evernote, Yojimbo, WikidPad (years ago), VoodooPad and a bunch of other solutions.  VimWiki is the best of the lot so far, though WikidPad was popular with me a few years ago.
  • Probably the most used plugin would be NERDtree, a file browser. Far better than any other option out there.
  • Other plugins I have, in order of most to least used: NERDcommenter, BufExplorer, Snipmate, VCSCommand, Ragtag, rails.vim and surround.vim
  • I’ve changed my leader key to “,” as I find it a little less of a stretch.
  • I use the Railscasts theme, and use 256 colors.
  • I use ack as my search command
  • I occassionally use the Fuzzy Finder Textmate plugin.
  • I admit to having a bunch of stuff in my .vimrc that I’ve forgotten about. Looks like useful stuff though, so I can’t bring myself to remove them!

My .vimrc is attached.

InezGarcia.com

Finally, my clever wife’s portfolio site is live. I started building this years ago, but didn’t have time to complete, so with some help from Damien at Melion Design and Deena, it finally got finished.

Check it out: http://www.inezgarcia.com

It currently uses Ruby on Rails 2.3.5, jQuery and Paperclip for attachments. It’ll probably be the first Rails app I upgrade to Rails 3.0 too, as it’s such a small app it should be the ideal candidate.

Starting SICP

After many web and in-person recommendations, I can’t ignore the gold standard of programming texts, Structure and Interpretation of Computer Programs, any longer, and I’ve started to work through the book. (It’s actually been on my shelf for a few months now, but Masters studies have kept me away from it.) It’ll probably take me a very long time to finish this thing — I want to do it properly, and I’ll have to get back to the Masters in six weeks.

Anyway, nothing revolutionary so far, aside from general LISP syntax, but I’m only forty pages in. I do appreciate the obvious thought that has gone into structuring the exercises, and it’s where I think the bulk of my learning will be achieved.

I hope to post explanations of some of the ideas here, mostly to solidify my own understanding.  Here’s to the journey!

Vim Snipmate Cheat Sheet

I’ve never really used snippets much, but I’m going to try and start. To that end, I created a Vim Snipmate cheatsheet for my main snippet needs (HTML, ERB, Ruby, Rails, Rspec.)

This is based on two plugins for Vim: Snipmate and Snipmate-Snippets (from Scrooloose).

Get it here: snipmate-snippets vim cheatsheet

No photo, but it’s up on the wall just to the left of my current setup.

My current setup

This is a small update to my post from last October on my setup. I’ve recently started a new job and changed my working environment. Now it is a little like this:

Two 24" monitors, Kinesis Freestyle keyboard, Kensington Expert trackball

  • Ubuntu 9.10 – I haven’t developed with Ubuntu in over a year, but this has been pretty painless. I’ve generally found usable replacements for most of my Mac software, though I’ve struggled with a couple. I’m loathe to give up 1Password, but I need something cross-platform.  On the plus side, I dropped flirting with Evernote and Yojimbo for a much better notes system: VimWiki, which has been amazing.
  • Two 24″ monitors in portrait orientation – It took a little messing around to get this working right in Ubuntu, but it’s been faultless since then. It sure is nice working with two large monitors, though I have changed the orientation slightly since this photo — Now I have one of them right in front of me, with the second sligthly off to the right (though still touching,) so I’m not turning my head as much.
  • Kensingtion Expert Trackball – I’m not sure about the trackball. It seems well made, and hasn’t been bad, but it doesn’t blow my socks off either. Generally I try not to use it all that much.
  • Kinesis Freestyle keyboard – This is by far the biggest change in my setup. Before I had this, I would get hunched over a little keyboard, and then leave the office with tension and tightness in my shoulders. Now I leave everyday feeling as fresh as when I got in, with much better sitting posture and no back stress. I recommend a real ergonomic keyboard to everyone who works with computers now. I can’t imagine not having it. The best thing is, it is so different to a normal keyboard, that I have no problem switching between my laptop and my work computer.

Components in Rails

I gave a talk at the RORO meeting in Sydney on Tuesday night (Feb 9th, 2010) covering the ideas of desktop development that have been used in web development, and how and why we might think of using components with Rails. In particular, I focused on two Rails based frameworks — Cells and Apotomo.

My slides (built for use with Scott Chacon’s neat Showoff framework) are on GitHub: Beyond Actions – Components in Rails slides.

My Programming Journey

Somewhat inspired by an old Jim Weirich post — yes, I’ve been meaning to do this for a while — here is a little history about my journey with computers and programming.

My dad worked with computers from before I was born, and we had home computers for as long as I can remember (at one time we had 12!) I’ll have to ask, but I imagine we had one from at least as early as 1982 (when I was 3 years old,) though there was no way on Earth I would even be allowed NEAR the computer at that stage.

No, my programming introduction began later. I’m not sure where it came from (possibly dad, perhaps the library,) but the classic series of books from Usborne on learning Basic, specifically aimed at kids, was pivotal for me. These books were mostly about programming games at various levels, but they introduced me to a wonderful world where the computer did what you asked. Soon I was also cruising Byte magazine for listings, really anywhere I could find more code. Everything I was doing at this stage was Basic, and while Dad had many other books, such as Peter Norton’s “Programmer’s Guide to the IBM PC”, these were largely impenetrable to me. It helped that one of my best friends in primary school was also way into computers. We swapped code, chatted on BBSes, and learnt a lot in the process (he now works for Pixar.) I loved coding, and created a lot of different programs, including a fairly rustic but workable text editor, a mouse based graphic program and a personal banking application. In fact, I’m convinced the banking application played a big part in winning scholarships to a couple of Sydney private schools.

Other random memories:

  • writing a column for the local paper about BBSes, winning an insane database package in the process. I believe it was called “Magic”, and boy was it a nightmare.
  • creating a programming language (in Basic.) I knew nothing about lexers and parsers, but the general structure was there. It couldn’t do much, but it worked.

During my teenage years I didn’t do a whole lot of programming. I was into the tracker music scene (though not particularly talented), and just general teenage stuff: sports, music etc, but I did build a robot controlled by my own code for a year 10 science project. The school computer teacher grilled me because he didn’t think I’d written the code myself, but after I proved I knew it inside out, he asked me to join the “programming team” for a statewide competition. Who even knew we had a programming team? I looked at the sort of things they had to solve, and they were so trivial and boring that I never joined up.

I still used BBSes a lot (I was a particular fan of Active BBS, and my friend Andre’s Mindflux BBS, both in Sydney), but when the internet first hit the mainstream I switched from BBS to internet and barely looked back. I built my first webpage in 1995. When I think back to the head start I had in that area, I really should rule the internet now!

I’d always had a general idea I wanted to be in business — for some strange reason I found accounting books fascinating — so when it came time to go to university, I decided on a Bachelor of Sciene in Information Systems, a combination of computers and business. I enjoyed this and did reasonably well — well enough that the computer people thought I was good at business and the business people thought I was good at computers. I took my first full time job as a consultant straight after uni, and was thrust into the world of corporate Java work. Despite my degree, I really had no idea what I was doing for a year or two, and it wasn’t till my second job that my learning accelerated. Now I can’t get enough of it, I devour every book in sight, and am constantly trying to plug any holes in my technical knowledge (though I wouldn’t swap the business and management training for anything.)

What a trip!

My Tools of the Trade

Inspired by MIke Gunderloy’s “Tools of the Trade” post:

Having just upgraded the hard drive in my laptop, and taken the chance to do a fresh OS install, I’ve had the opportunity to review almost all my tools. Here is how I get it done:

Hardware

  • MacBook 13″ 2008 unibody, 4gb, 500gb 7200rpm drive – I use this all day, every day, and I *LOVE* it, easily the best computer I’ve owned. So physically solid, and OS X is the most humane operating system I’ve encountered, (but not perfect, oh no.) I’ve just upgraded to the 7200rpm drive, which seems noticeably snappier — although it could be the fresh OS install as well. Incidentally, I could only get a 500gb drive! I really only need a 250gb, but they’re just not available. Anyway, I’m hoping I’ll be able to get a 250gb solid state drive for under $500 in the next twelve months.
  • Standard Microsoft Mouse – Does the job. I’ve seen the Kensington Expert Mouse trackball mentioned twice in the last 24 hours, so I’m taking that as a sign, and will probably try one out soon.
  • Backup drives — one at home, one at an off-site location. Rotated every couple of weeks. Backups using SuperDuper! nightly. Basically following JWZ’s advice

Software

  • MacVim – I never really gelled with TextMate. Vim feels like home, even though I only really started using it in anger mid 2008.
  • Eclipse – Mostly I hate Eclipse. For the benefits (code navigation and refactoring), the hassles just seem to much. Don’t get me wrong, I know my way around it, and I’m efficient at using it, but there’s too much lost time as well. An IDE is essential for Java work.
  • Pixelmator – Pretty easy to use, though I don’t push it much.
  • Namely – I used to use Quicksilver, but it seemed like overkill, and wouldn’t pick up new applications quickly enough (probably configurable, but it should just work.) Namely JUST launches apps, and does it quickly.
  • Evernote – Unbelievably, you can’t seem to link between notes, or make a note hierarchy. I don’t like Evernote all that much, but there’s an iPhone app, and the sync seems reasonable. I wish there was a better option.
  • 1Password – It works, but they’ve really messed up the 1Password 3 / Snow Leopard issue.
  • Zotero – Crucial tool for organising my academic readings. The magic is it takes citations straight from Google Scholar, and handles different formats for material seamlessly. Combined with Skim (see below) it feels like a differentiator compared to my classmates’ systems (Endnote, for instance, which just feels prehistoric.)
  • Skim – Beats Preview for annotating PDFs. Works brilliantly in tandem with Zotero.
  • SuperDuper! – Schedulable backups.
  • Things – There are a million organisation apps and systems out there, and I’ve tried a few, and this one seems to do enough to stick. Probably the fact that there is an iPhone app means something to me, even though the sync system is annoying.
  • VMWare Fusion – Parallels was my virtual machine of choice with my first Mac, but VMWare Fusion just seems faster and more stable. Looking forward to the 3.0 release at the end of the month.
  • Balsamiq – This is a great way to create mock ups of user interfaces. The best part is that they’re a little rough, so clients don’t get too attached. Kills Visio.
  • SizeUp – A nice way to tile windows in OS X. It’s no Awesome (a Linux tiling window manager,) but it does the job.
  • SelfControl – Because sometimes/often I can’t stop the distractions from, well, distracting me.
  • OpenOffice – Works great for me, although we have Excel spreadsheets for reference data that have macros, and OpenOffice doesn’t help here.
  • Fluid – Mainly I use this for a dedicated JIRA browser.
  • Firefox – Wins for its supreme web development tools, like Firebug.
  • iTerm – I’d use Terminal, but it doesn’t do 256 colours without a lot of hackery.
  • Adium – I don’t really like chat all that much, but this works.
  • Colloquy – Man, I really suck at IRC. I fire this up about once a month.
  • iTunes – I fought iTunes for so long. Songbird had my vote, but when I got an iPhone, it had to be iTunes.
  • VLC – Plays media! Works!
  • Unison – A great way to keep my music library in sync over two machines.

Incidentals

  • iPhone – Best phone ever. Man, when I think back to that stupid Blackberry that I dealt with for a year, I get all angry.
  • Mac Mini – Serves media around the house, and light browsing.
  • Dell 24″ LCD – This was great when I was doing a lot of work from home, but its just the Mac Mini screen now. It rotates to portrait orientation, which is great for coding.
  • MacBook Pro 15″ 2006, 2gb, 80gb – This was my first full time Mac, a nice computer. It doesn’t compare to the new one though. It is my wife’s computer now.

Wish List

  • Fancy keyboard – Kinesis, Das Keyboard? I don’t know, but it feels like I should have a swish keyboard.
  • Trackball mouse – As above, I think I’ll try a Kensington Expert Mouse this week.

Installing Java 1.5/5.0 on Snow Leopard

Most people are pointing to the OneSwarm instructions for installing Java 1.5 on Snow Leopard (it has been saved 100 times in Delicious.) While they do work, the following instructions (saved only 24 times in Delicious) here at chxo internets are much easier, and work just as well. It also feels safer and cleaner since the Java install is coming directly from Apple.

Using render_to_string in view or helper

I suspect some Google searcher is going to find this useful one day…

In Rails, render_to_string cannot be used in a view or helper, as it’s an ActionController method, not an ActionView method.  Instead, you can use standard render commands.  But beware, using render :file will set the content type header to the type of the file. Rather, read the file into a local variable and use render :inline.

I’ve just confirmed this in Rails 2.2, and I suspect it’s a recent thing, as I don’t believe it always worked this way.

Next Page »