Thursday, April 21, 2011

Compiling brunch from source

Background:

Brunch is a client side web app framework built using a number of open source tools and libs from the world of javascript and node.js: CoffeeScript, Backbone, Eco templates, and more.

The steps

  • Pull source from Github
    git pull https://github.com/brunch/brunch
  • check if you have all the brunch dependencies:
    ./bin/brunch --version
  • Building from source means you don't get the dependency management of npm as easily.
    You must have node installed, and the required packages:
    Note: at time of writing Stitch was not defined in npm dependencies but required
    npm install stitch
  • Compile brunch with Cake:
    cake watch
  • To create a project:
    ./bin/brunch new --output $locationOfNewProject

Friday, April 15, 2011

Nerd Tree: A File Explorer with Mac Vim

The one thing missing from the great text editor that is Mac Vim is a project / file explorer side bar. Competing text editors such as Sublime and Text Mate have one, so why not MacVim? It doesn't seem like it would require too much additional work of the developers. Reading through debates the community has had on the issue, the reason appears to be the elitist and idealistic nature of the Mac Vim community. Please don't read that last sentence pejoratively; these guys are purists, and very good at what they do. There were quite a few in the community who believed NERDTree was more than enough for any code jocky's needs, so I decided to checkout what all the fuss was about.

I use pathogen to manage vim plugins, and it is especially useful in conjunction with a public source control system like github. Once you have pathogen installed simply pull the NerdTree Github project to your vim plugins directory.

cd ~/.vim/bundle
git clone git://github.com/scrooloose/nerdtree.git


Next add a shortcut to make opening your NERDTree more convenient by adding the following to your vim config file (~/.vimrc)

" Give a shortcut key to NERD Tree
map <F2> :NERDTreeToggle<CR>


Now fire up your MacVim, open a window, and press (fn+F2).
With NerdTree now started, the following commands should get you going:

  • Use the natural vim navigation keys hjkl to navigate the files, or just the arrow keys

  • Press o to open the file in a new buffer or open/close directory.

  • Press t to open the file in a new tab.

  • Press i to open the file in a new horizontal split.

  • Press s to open the file in a new vertical split.

  • Press p to go to parent directory.

  • Press r to refresh the current directory.



Tip:
Open a project with mvim + nerdtree from the command line like this:
mvim ~/Dev/path/to/project



Happy Coding!

References:
http://www.catonmat.net/blog/vim-plugins-nerdtree-vim
http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen
http://wiredupandfiredup.blogspot.com/2008/09/pimp-your-macvim.html