If you are like me, you get a lot of business and personal mail. Often the answer is repeated over and over. When I lived in Istanbul, my friends (and even their friends) asked me for trip advice, other friends want to start learning to code and ask me for the best resources.
TL;DR
You can use Dash (on OSX) to quickly access and adjust text templates that you often use with Dash's snippets.
Before: Snippets as text files
I saved quite a few text snippets as simple *.txt
files that I would quickly find via Apple Spotlight's full-text search capability. So with the request for coding advice as an example, the steps involved where:
- Receive a mail about
coding resources
- Hit reply
- Fire up Spotlight (
⌘+Space
) with the search querycoding resources
- Open
reply_coding_resources.txt
with a double-click in TextEdit - Copy the content
- Paste it in the reply
- Browse the snippet and adjust salutation and minor details that differed from the snippet
- Hit send
Can I streamline that?
After repeating these seven steps over and over, my programmer self thought about how to simplify this. I took a look at TextExpander – I would not mind paying $3.50 a month for an ever-evolving product, but the problem set for snippets is finite and already well being worked on and aText – good feature set and price, but I did not like the UI and workflow too much.
When I inserted some HTML snippets, it instantly dawned on me:
I already have a tool for managing snippets – Dash
.
After: Dash Snippets
Dash is an offline-first documentation browser for programming languages for Mac OS X. You can download and browse documentations for a large number of languages – and save snippets that you can use in any program. It's about $25 once, but for that price you get an excellent documentation browser and a snippet tool. Dash uses Mac's accessibility tools, so you first need to enable it in your Mac's settings.
You can set triggers that paste the snippets. For your non-programming text snippets, I would advise you to use an indicator not being used in the programming languages you use.
I use §
for this. In your snippet you can use __placeholder__
for, you guess it, a placeholder that you can fill interactively when you paste the snippet.
So here is the workflow for the same coding advice snippet from earlier. I'm assuming that Dash is set up to run at startup and is now sitting in the background waiting for your command.
- Receive a mail about
coding resources
- Hit reply
- Type
§codingresources
- Change the salutation interactively
- Hit send
It's not only two steps less than with my previous solution, but also faster and less error prone. At the beginning, I tried to come up with really short indicators, such as §cdrsc
but of course, these are hard to memorise. So I would advise you to use full-length descriptions.
You could use this technique not only for quick personal responses about coding resources but also for an easy customer support. It is fast, easy and with no big learning curve.
Top comments (5)
can i have snippets hierarchy or split the text file which saves the snippets? I have some snippets related to work and some other which are global dev ones I want one to be public (so i can store the .dash snippets in github) and the otehr personal. but I saw it can reference onkly a single .dash file, may i ask how do you deal with it?
Unfortunately I never tried to separate snippets. Actually, I switched all my snippets to
Alfred
as I use it for pretty much all workflow enhancements anyways. You can set up various snippet folders and hence separate pretty easily.Hi, yeah :) I just purchased alfred yesterday in order to use the workflows. While I like it, i saw the main advantage of
dash
overalfred
in the way that when i did search then on the right side of dash there is a very large window with the result, in alfred it's just a tiny window with a single line and sometimes I search for something like:scala json serialization
which gives me more like a gist meaning more than a few rows (a whole screen filled with json serialization stuff), and I like to see them all (almost one page) and then choose from within it what i need. Currently as i see things my workflow would be:My biggest issue with the above is that I don't have a single note taking app :( . While I know alfred can be connected to dash (just connected) it's copying the gist, and also when i search in alfred it's showing results as one liners and I need to see the whole right side window in order to decide if this is the search I wanted or continue refining the search.
What do you think?
That sounds like a good setup. I agree with the shortcomings of
Alfred
when you have longer snippets. I useSublime
for these as it is my primary tool for work and I can share.sublime-snippet
files easily in any way needed. For note taking I useBear
app as I love how simple it is and how nice code snippets look in it. I often use it to write down best practice in Q and A style. And no, I don't fear duplication. For me there are just two important things for (code) note taking: Document it when I am on it. And: Make sure I find it again.Funny timing. I was just asking about an alternative to TextExpander in the Changelog Slack yesterday, but was hoping for something open source (no dice, as far as I can find).
I'm already a big Dash fan for the docs side, but have never used its snippets features. I'm going to try this out today. Thanks for this!