Last month I realized, that I’m reusing the same text snippets over and over again. This wasn’t only code, but also mail messages and terminal commands. I wanted to waste less time with typing and/or copy and paste, so I started to search for a solution. Its name is Dash and costs about EUR 20.
What is Dash?
Let me quote the official website: Dash is an API Documentation Browser and Code Snippet Manager. Dash stores snippets of code and instantly searches offline documentation sets for 150+ APIs.
If you’re a developer, you often have to read documentations and/or search for solutions on Google, StackOverflow, etc. With Dash you don’t need to copy the code, open your browser, paste it there and search for solutions: After you download the references you need, you can access them on your system. Offline and always up-to-date at once. Dash has a lot of plugins, that also assist you right in your favorite IDE. Simply mark the text you want to look up, press your pre-defined keyboard shortcut (IDE settings) and let Dash pop up.
But even though I’ve been using the software for some time, I never tried out its snippets function. I simply didn’t realize its existence until I searched for a snippet manager in the App Store. Also, none of my friends who bought Dash knew about it. Everyone was only using the documentation feature.
What’s a snippet?
Wikipedia says, that a snippet is a programming term for a small region of re-usable source code, machine code, or text.
The most important word in this definition is “text” because snippets aren’t limited to be code fragments. It’s up to us, how we want to use them. And this is, why Dash is great: We can use it for development, but we aren’t limited to. Snippets can be used in every application on your OS.
Snippet management via Dash
The configuration is very simple: To use system-wide snippets via Dash, you only have to define an abbreviation and (of course) add a snippet. If you’ve defined variables (do this by using two underscores before and after the word/text you want to replace in the future), Dash also offers them to be filled out.
For this website I use Jekyll as a blogging system, Grunt takes care of all the assets and Git handles the version control. When I want to compile the website and its assets and prepare it for deployment, I could either type
cd ~/Sites/blog && jekyll build && grunt images && grunt production && git commit -am "My commit message" && git push by hand, or I define a snippet in Dash.
In this example, I use
jekc as the abbreviation. So whenever I type
jekc within the terminal app, I’m asked, if I want to use the pre-defined snippet and must only enter a custom commit message. The snippet is then loaded into the app.
Sure, there are other ways to do this: Create aliases, use the system preferences to replace text, but it’s a lot more stressful to handle the snippets. Dash offers me a way to keep them all in one single application with minimum effort to manage them—no matter what kind of snippet it is.
I use Dash to finish emails more quickly, to create SSH connections without the need to remember accounts or IP’s and—of course—to manage code snippets. Because I put the library into a synced folder, I can use the same snippets on all my computers. Dash saves me a lot of time.