Some Quick Tips for Using Dash

I love dash. It allows me easy access to documentation to different programming languages and frameworks, without needing to be online. And it allows me to easily search for the documentation. This means I can work anytime, anywhere on most of my projects.

This is a quick post about the things I use dash for on an everyday basis.

Built in snippet manager

I have a couple of snippets I use again and again. The most commonly used is my userstory snippet. I start it by writing the word Userstory in any text application - and opens a little box for me.

userstory image

This makes it easy for me to type in userstories that adhere to the rules. “As a website visitor I want more to know more about dash so that I also can be awesome”

A word of warning though - if you have a snippet for something and its abbreviation is something too common - it will expand everytime you write that string. (So prefix something like that, with something very uncommon like a backtick or a double comma)

Search Profiles

Any hardcore users of dash will at some point run into that they have too many docsets for it to be useful when searching across all docsets. (If you prefix your searches with keywords all the time, fair enough … However I find that this is too much typing for most cases).

Instead you should set up search profiles which allows you to bind a global key combination to search only a subset of docsets. My search profiles are Ruby (ctrl+opt+cmd+r - for Ruby and rubygems), Javascript (ctrl+opt+cmd+j - for Javascript, Node, jQuery, Lo-Dash, Underscore and CoffeeScript), RubyMotion (ctrl+opt+cmd+m - for RubyMotion and ios), Backbone (ctrl+opt+cmd+b - for Backbone, jQuery and Underscore), Css (ctrl+opt+cmd+c - for Css and Sass) and then a couple which just has a prefix.

Vim plugin code

There exists an official Dash plugin for vim - I have never used that though. I stole my code from Simon Hørup Eskildsen - or rather his dotfiles repository. I have only made one minor change.

His original code would search dash for the word under the cursor when you typed leader+d. I decided to have a bit more context, so I added the current filetype as a prefix. For most of the things I work on - that will narrow the search down to one docset - one some things I have made my own prefixes - to get a bit more results (e.g. html includes bootstrap and foundation, and most templating languages are mapped to that same set of docsets)

Add this to your .vimrc for instant dash searching from vim.