A solution for developing remotely: Vim's netrw

I'm doing some work that has to be developed remotely, so I wanted a way to edit locally instead of doing everything in a terminal window. I tried using MacFUSE and sshfs to make the remote directory appear on my own desktop, and it worked after I figured out the options I needed, but opening files in gvim was very slow.

So I took my friend Ed Marshall's advice and tried Vim 7's netrw support. Bingo! It works via scp (which is (almost?) always available when there's ssh access) and is dreamy.

To edit a file /path/to/file.rb owned by a user joe on a machine example.com:

vim scp://joe@example.com/path/to/file.rb

Brief pause while the file gets retrieved, but then it's copied to your /tmp directory and everything's full speed. The only downside I ran into was that inter-file navigation wasn't as good. To get a file browser for the files in ~/path/to, I could then do:

:sp %:h

or to edit ~/path/other_file.rb (again from a window opened on ~/path/to/file.rb):

:sp %:h:h/other_file.rb

:sp means "split window". % means "the current file". :h means "the parent directory of the preceding file path", and can be repeated.

I'd love to hear more about navigating in Vim + netrw—I haven't even gotten my feet wet yet. I just wanted to share the nice experience I had right out of the box.

Hidden in plain sight: script/runner

I am loving the opportunity to work with my co-workers in the home office. We have "geek-out" lunches in the office once a week or so, and invariably all learn something.

So today I learned about script/runner, a file that's in every Rails app that I never looked into for some reason. Turns out I wish I had. It's a replacement for calling the Ruby interpreter that gives your script your app's Rails environment preloaded, so you can just write Ruby code without having to monkey around with loading Rails yourself. Just call something like

script/runner my_file.rb

or

script/runner "puts 'My Ruby code here'; puts MyModel.count".

What are your favorite "hidden-before-your-eyes" features of Rails?

Welcome Dave Astels!

I'm excited to welcome Dave Astels to the Obtiva team. Dave is a very active member of the Agile community and has shared some ideas over the years that I have found very valuable for better understanding TDD. It's an honor to have him working with us.

Obtiva is shaping up to be quite a strong software house with a promising future.