Loving SourceTree

Being a relative newbie to git I really appreciate the Atlassian's new SourceTree app.

  • Free
  • Easy to start
  • Deep feature set 

The last few GUI git clients I've tried attempted to mask the complexity of the git feature-set whereas with SourceTree I feel like I can actually explore that feature set. I've already begun embracing branching way more as a result of the nice visualizations and as a bonus my command line git usage is also improving. Great little tool.  

iTerm2 vs Terminal.app (iTerm2 FTW!)

I just switched from the built-in Terminal.app on Mac OS X (which I've always liked) to iTerm2. Here's some of what I like about iTerm2 :
  • borderless windows
  • better scrolling and mouse support (or better defaults?) I can use my scrollwheel in vim by default and clicking on a word moves the cursor which is a nice bonus (behaves like unix) 
  • feels faster; I was having issues with Terminal which seemed to be related to using Microsoft's Consolas font coupled with transparency and blur which was causing ever so slight but hugely annoying key lag in vim. (key lag in vim? really?) 
  • remap the modifier keys!!! This was actually the reason I started looking for an alternative because my mac's "option" key is where I expect my control key to be and it was a source of continual frustration in vim and elsewhere. I remapped Left option to be a control key and life got better. 
Check out the features page for a full list of goodness offered over the default Terminal application shipping with Mac OS X 10.8 and below... bunch of features I have not even started using yet

I am a technology tourist (or first impressions of Dart)

So this week I met with someone who was very excited about working with Google Dart, a web programming language aimed at being a better JavaScript running both on the server and ultimately the client where the VM could run in browsers (only chromium for now). When Google first announced Dart in September '11 I thought "cool, too bad it will never work" and basically dismissed the project as doomed since it would presumably face too much pressure from competitors and open standards. After the failures of Flash, Java (applets) and most recently Silverlight it's hard to imagine Google having an ability to convince the world to abandon JavaScript in favor of Dart. Even GWT seems to be losing Google's attention somewhat. Having just been burned my MSFT on Silverlight I am overly wary of any proprietary tech these days.

But what I overlooked when I initially dismissed dart was the dart2js compiler and the fact that Dart doesn't really need the Dart VM to succeed for the language to get some traction. So skepticism temporarily put on hold I decided to port a small existing project from jQuery to Dart. The project was pretty simplistic, about 175 lines of Javascript served up statically and allowing users to navigate a full page grid with vim-like keybindings, entering free flowing text in "contenteditable" divs within the grid.

Some thoughts on the experience:
  • Dart editor based on eclipse is handy and the integration with chromium made the whole experience of getting up and running with the SDK really easy
  • Classes! Optional Types! (or ?) Libraries! Isolates! Lexical Scoping! All very nice and immediately familiar in the resulting code.. although I did find myself momentarily confused by: 
    • lack of object notation (use Maps instead) 
    • lack of dot access to those map properties
    • lack of explicit private keyword  (use _prefix to indicate private) 
    • lack of string concatenation (use string  interpolation, which I actually really like) 
  • handling of concurrency is really interesting not just in the Isolates but also in the "Future" type which makes for some really clean chaining of asynchronous calls such that you are not nesting N levels of callback functions. Didn't use them but they looked cool.
  • There are equivalents in the "dart:html" library for a lot of what you'd commonly reach for in jQuery, but in general I found myself writing more verbose code than what I was doing equivalently in jQuery. That said... 
  • I had WAY fewer error cycles in Dart, and the semi-static typing made the whole conversion process take only a couple hours including all the time spent looking things up..
  • ... and looking things up was pretty easy, you can tell it's largely from Google but they are investing enough in their docs that it was always pretty easy to get what I needed
  • A nagging feeling... While dom manipulation was straight forward I found myself cut off from Javascript. It looks as though calling between them is totally doable but feels hacky as soon as you go down that path. Dart itself assumes just enough responsibility that leaving the core libraries feels like foreign territory effectively isolating you off from all of the innovation happening out there in Javascript land. I may be making a mountain out of a molehill here but having to choose between Dart native libraries and Javascript community for common tasks is not pleasant.  
So all in all it was a really positive experience, the tooling is solid, the language itself is very comfortable for someone with my background and I can see clear advantages especially on a larger project.  But I'm now at crossroads on this little project,  do I go with the comfortable tools and language with questions around the long term viability and community support for the proprietary Dart (to be fair it's open source, but open source doesn't remove the fact that this is very much a Google initiative) or do I stick with the "open web" and just deal with all the pains?


After a couple days and writing this out I decided I just can't commit to Dart yet. There's too many exciting developments happening in the open web and Dart feels too much like unnecessary fragmentation of the collective efforts to improve things.  Will be keeping an eye on this though, just because it's cool. The project's ambition is admirable and it feels like they are just getting started. 

How does vim keep sucking me in?

I "grew up" on vim, which is to say my second professional programming job 15 years ago required me to spend vast quantities of time in a terminal to a Solaris machine on which I used vi exclusively to get work done. In those two years I got relatively proficient at navigation, search and replacing, using registers, and tweaking .vimrc with custom settings and macros. I did NOT get into folding, window management, syntax highlighting, or plugins. Things have changed a lot in vim-land.

not sure who to credit for this image - taken from bulgarian forum ranting about joomla! http://www.predpriemach.com/showthread.php?t=32821Watching a friend operate vim last week triggered weirdly intense pangs of jealousy and masochistic visions of how I too could suffer through horrible learning curves and bouts of frustration in order to eke out those extra few moments of productivity per day. How I too could spend hours meddling with plugins and hacks, custom scripts and a terminal to get features which every modern IDE user now takes for granted. I romantically pictured my hands rooted on the homekeys, flying through mountains of text like a boss, and the legions of adoring co-workers who would wonder at my elite skills. Totally will happen.

So for what feels like the Nth time, I re-approached my old friend vim. It was shocking how much of my muscle memory had been retained, but it was also shocking how much I miss features like "find usages", "refactor...[anything]" and quick project based shortcuts for getting around files.  One of the plugins my friend was using was NERDTree,  which provides a pretty nifty tree project/folder navigator as a window in vim. Almost but not quite a project view.

And when it comes to plugins, all the cool kids these days are using the social git-goodness of github combined with a neat plugin called Pathogen to create "dotVim" repositories which make the whole process of managing, sharing, and installing your perfect vim environment far far simpler. Branch a dotVim repo, symlink it into your user folder and you're off. You'll find a ton of documentation out there on how to make it work so I won't repeat it here.  I based my latest attempt at vim heaven on Kody Krieger's dotVim, which is a slimmed down version of Janus which uses Pathogen. I particularly liked that installation of this is bootstrapped so you can run a single command in the console to get started: (which of course I had to inspect before running because I'm paranoid like that)

curl https://raw.github.com/codykrieger/dotvim/master/bootstrap.sh -o - | sh

Anyway, after dealing with some issues as a result of missing plugins (slim, which looks to be fixed since I installed) I was off and running. I ended up deleting the ruby specific plugins and adding a few color schemes but have otherwise only changed the .vimrc (macros, and tabs not spaces damnit! unless it's python, then spaces are ok)

NERDTree is great, but I find myself still relying on good ole :e for most things
Ctrl-P is fantastic but I find it doesn't always work, I'm guessing I need to feed more information about my context to it so that it searches the right paths. When it does work though it's basically :e on steroids.
Fugitive is amazing, and the ability to quickly pull up a diff on what you're working on is lovely. I still hit the command line more often than I probably need to.

There are a bunch of others in here that are probably making life nicer without me even knowing...still much to learn.

I quite like the git repo approach and the fact that I was able to tweak everything on my laptop and then just clone to my desktop at home was pretty fantastic. I will say though that I find the sub-modules a bit of a nuisance. I don't really need to be on the bleeding edge of vim plugins and I'd rather have full control so I removed all of the submodule aspects to the above dotVim and will just pull updates when I hit bugs or need new features. The end result of my efforts are on bitbucket.

To commit myself more to learning the editor I've also started using it for writing simple text documents as well like the government forms I'm in the process of filling out. It's fun to make a terrible job an opportunity to refine your tool skills.  Vim out of the box is not great at handling paragraphs of text however and so a few tweaks are required. I have the following in my .vimrc which allows me to quickly enter "prose" mode (fixing line up line down in wrap mode being the biggest element for me)

" setup the current vim instance for writing prose style
command! Prose call SetupForProse()
function SetupForProse()
  "break lines visually, and don't group hardbreaks on previous word
  set formatoptions=1
  set linebreak
  set wrap
  set nolist

  "set breakat=\ |@-+;:,./?^|

  "change default cursor keys to work on visual not actual lines
  nnoremap j gj
  nnoremap k gk
  vnoremap j gj
  vnoremap k gk

  "border on the left hand side
  set foldcolumn=7


On with the self torture!