What Do You Use for a Code Snippet Tool?

Good point about syntax highlighting.

I've been extensively testing CodeBox, Dash, and Quiver for several days now.
At this point, Dash seems better, but is still missing some stuff I really need, like a Snippet Title field that is NOT the Snippet expansion code.

I do really like the syntax ref, document lookup that Dash provides. The fact that it goes directly to the search term in the document is very helpful, unlike a google search that returns the document (like AppleScript Guidelines doc), but the actual thing I'm looking for is buried in the doc.

Thanks for sharing your thoughts and experience.

I like Dash, but I think the snippets manager section needs improvement.

I sent the Dash developer an email with some enhancement requests, and his reply was positive. Looks like he is working on a major upgrade for the snippets manager.

My my email and his response:


###From: Kapeli support@kapeli.com
Date: Sat, Aug 1, 2015 at 12:51 AM
###Subject: Re: Dash Enhancement Request (ER) for Title field

Hi JMichaelTX,

Is there any chance you could work this change in any time soon?

Nope, sorry. I plan on revamping the snippets features completely, so all of the features will come at once.

Regards,
Bogdan


On 01 Aug 2015, at 02:21, JMichaelTX wrote:

Bogdan,

Thanks for the reply.

Although all of the below ERs would be really helpful, I feel like #1, Title field, is essential.
I must be able to give the snippet a friendly, readable Title, while having, or not having, a snippet expansion code.

Is there any chance you could work this change in any time soon?

Many thanks.


From: Kapeli support@kapeli.com
Date: Wed, Jul 29, 2015 at 4:35 PM
###Subject: Re: Dash Enhancement Request (ER)

Hi JMichaelTX,

###Most of these features are planned, but I'm not sure when I'll get to them.

Sorry for the inconvenience!

Regards,
Bogdan


On 29 Jul 2015, at 23:45, JMichaelTX wrote:

Hi. I really like Dash, especially the API doc browser.

###However, I really need two more fields for the Snippet form:

  1. Title — separate from the Snippet Appreciation
  2. Rich text block where I can:
    -- Describe the snippet and document references
    -- Include rich-text hyperlinks (not just the URL)
    ###Also, two date fields would be very helpful:
    -- Date Created
    -- Date Updated
    ###Finally, I need a more selective Search engine, so that I could limit the search by these fields:
  1. Language
  2. Tags (including excluding tags)
  3. Words in the Title (include or exclude)
  4. Date Created range
  5. Date Updated range
  6. Snippet Appreciation (expansion text)

Thanks.

Just noticed that Quiver is on sale for $1.99 in the Mac App Store. https://itunes.apple.com/us/app/quiver-programmers-notebook/id866773894?mt=12

1 Like

That's a real steal for a great snippet tool, which is also a general purpose programmers notebook. See

If you wish to try yet another tool, I can recommend aText at $4.99. It has an amazing range of options (especially in the insert department), and I use it daily (see image), though I don’t use the snippet in the image … it was only to show some of the options.

What’s wrong with a text expansion tool such as Typinator? (I forget if TextExpander can handle pictures, formatted text, and html, but Typinator can.) What are your criteria for a good clippings manager?

Scale :slight_smile:

I typically need to paste about three functions at a time, in unpredictable combinations.

With Quiver plus a KM-launched script (which keeps MRU memory in a KM variable), I can do that in parallel with multiple selections.

Single selections I can jump to directly with the initial character(s) matching property of a select from list control.

Typinator has its role for some boilerplate insertions, but is less well matched to frequent and multiple selections from a library of functions. 100+ mnemonics gets unwieldy.

I actually used Quiver before but now use SnippetsLab as I find it much better than Quiver both aesthetically and functionally. I only keep code snippets in there with comments. It looks something like this.

The best thing is that it has a native alfred search and I can instantly find the note I need. I tried to like Quiver and used it for a bit but really do find SnippetsLab much better for that sort of thing.

1 Like

Thanks for sharing your review on SnippetsLab. I had not heard of it. From my quick review, it does look interesting. I may have to check it out.

Yep, SnippetsLab looks good, too. Unfortunately no trial.

A downside I see: There are no (concrete) plans for iOS.

@nikivi, what exactly do you like better with SnippetsLab (functionally)?

I love the idea of cells in Quiver but I found there was a certain lag when switching between the cells and going to the cell that I needed quickly. For a code snippet manager, I need good organisation capability, easily adding snippets to the section I want, ability to add notes and comments, very quick retrieval of snippets. The quick retrieval of snippets is instantaneous with the Alfred workflow that developer provides with SnippetsLab. Plus the application looks a LOT better than Quiver. I am very keyboard centric person and I very much dislike having UI that I do not use be in the app and Quiver had a lot of that, I contacted the developer and he had no intention of changing it. SnippetsLab feels a lot faster has great language support, has a thing with fragments where you can split a snippet into different parts with corresponding notes. It just feels much better to use.

If you are interested, I have made a list of all the top applications / workflows / safari extensions that I use on my laptop. SnippetsLab is one of the top on there. :slight_smile:

1 Like

Thanks for the details.

I just went through the online documentation. The smart groups thingy can be very convenient, I imagine.

If you are interested, I have made a list of all the top applications / workflows / safari extensions that I use on my laptop.

Seems interesting. I will read through it in the next days.

I have such a list (currently only Mac apps), too :slight_smile: Go here.

1 Like

SnippetsLab

@nikivi, thanks again for your detailed review of SnippetsLab.

At first I was very satisfied with Quiver. But now that I have 400+ Notes/Snippets in Quiver, I am finding the search facility to be lacking. And, there is no built-in means to copy/paste a snippet into another app (although that would be easy to create in KM).

As I understand it (not having used it), the Alfred workflow for SnippetsLab should work easily with other tools (KM, AppleScript, etc), since it is simply based on a custom URL scheme.

But what has really impressed me about SnippetsLab, are its Smart Groups, and the same basic syntax that can be used i a general search/filter. This is not available in Quiver.

I'm giving serious thought to buying it, since it is only $10.

Anyone else have comments on SnippetsLab?

Well, I'm back to Quiver now, mainly because each Quiver Note can have multiple cells. I can first have a rich-text cell to document and provide links for the snippet, and then a code cell for the actual snippet.

The search in SnippetsLab is still superior, but the Quiver dev says he's working in improving Quiver Search, including adding Spotlight Search.

Bottom Line: Try both, and see which one works best for you.

Just updated my OP with my new approach.

2 Likes

I am a snippet amateur, but I am enjoying SnippetsLab a lot.

Folders, Smart Folders and tags help me feel like my snippets are organized. :slight_smile:

@JMichaelTX Thank you for so generously sharing your approaches and for innovating!

If I may ask a few questions, as today I started thinking about libraries and snippets to avoid trying to do again what I have done before :slight_smile:. And I came here and searched, and of course found the right thread.

This makes so much sense. Using software like SnippetsLap is interesting, but it is yet another tool to manage. Curious as to how do you send snippets into suitable storage files - meaning macro, script, shortcuts...

Evernote vs DevonThink - Have you evaluated? I am guessing you did. I had purchased Devonthink - the last version, but soon felt that it would be better to manage files in Finder itself and use spotlight etc. Evernote on the other hand is interesting because it creates a container oriented structure for documents where you can attach images and PDFs etc in a note.

So do you have flat tags or hierarchical tags? And when convenient, would love to hear how you assign tags (has to be frictionless :slight_smile: ), and if you leverage tags for filing etc as well.

Do you mean in file save dialogs?

Again, would be very interested in knowing how you organize these? Would be great if I can do it.

so do you use the script libraries in a standard and system wide location? And if so, how do you deal with version control as you may be tempted to change a function in a script library and that can break an earlier code?

I am sure you have shared this but I searched and did not find any.

Thank you again!

1 Like

I use SnippetsLab to keep code snippets/patterns.

And I use TeaCode to expand them out with token replacements.

Honestly, a FANTASTIC setup for me. So happy with both apps.

1 Like

@keyskeys Thanks for sharing. Could also use SnippetsLab and TeaCode. Tempted to because they seem to be custom designed for this purpose.

But trying to reduce the proliferation of Apps and instead hoping to do with Finder and TeaCode. Am a hobby developer at best...

1 Like

Most of my snippets, i.e. very short lines of code, go into Typinator.
Short block of functional code first go into a .scpt file in my "Dev" top level folder, in the appropriate category sub-folder.
If it looks reusable, then it ends up in my personal Script Library.
All of the scripts that I use with KM go into my KM/Scripts folder

Notice I said "Dev" top level folder. My design is such that if I am looking for something, I do a Finder Spotlight search from the "Dev" folder. Every script I have is somewhere in a subfolder of "Dev"

All of my development and testing is done using Script Debugger 7. So I just save from there into the appropriate subfolder.

Yep, years ago. It sounded much better than Evernote, and it probably is, IF you need all of the features it offers. I found that for my needs the additional complexity of DT was not worth the return. Another big factor for me is the Evernote Web Clipper is superior, bar none, and I use it many times a day.

The Finder does not support hierarchical tags, but my workaround is prefixes. So, I have prefixes for:

  • SW
  • Lang
  • Cat
  • Type
  • Author

I sometimes use subcategories. Here's an example:
SW.OL.365

So the prefixes make it work like a picklist. Here's an example.
I just type "cat." and my list appears:

image

Yes, just like above.

Just do what is intuitive for you.
All of my Typinator snippets use the same naming convention:
;MainGroup.SubGroup.DescriptiveAbbrev followed by a SPACE

The "SubGroup" is optional, and only used if I really need it.

Here is an example of by AppleScript group:

image

I'm not as consistent as I should be, and I don't always remember the Typinator abbrev. But it has a quick search that searches in both the abbrev and in the Description (shown in light blue above)

All of my official Script Libraries go into the required folder:
~/Library/Script Libraries

Short answer is I don't use VC, although I probably should.
Since Script Libraries are compiled scripts, they don't lend themselves to VC of the individual handlers (functions) in the SL. I do maintain a Ver# and Date for every handler. On the few occasions that I needed to change a Lib that might break existing scripts, I just do a Finder Spotlight search on the handler to find the scripts, and fix them. Fortunately it has only happened 2 or 3 times over many years.

One of my ways around this is if I come up with a really much better way of doing something that will break existing scripts, I just create a new handler with a new name, and use that going forward. I only fix existing scripts as needed (and most don't need it).

If you are talking about my Macro that allow me to search for a handler in one of my script libs, and then insert the call, or the actual handler, then I'm not sure I ever published it. It is very complex and I've been tweaking it over the months. I'll see if it is ready for public release.

My main design is Finder Tags used with Finder Spotlight search. Of course, until you have most of your files tagged, the search won't work as well. But if you choose that method, just hang in there for a while until you have enough files tagged to start seeing the rewards. Also, don't forget that Spotlight is also great at search for text in the file name, and/or text in the file itself.

Good luck. The main thing is to just think about a system design that might work for you, do a bit of testing, tweak as needed, and then dive in. It won't be perfect the first time, but you'll learn more about what you really need from using some design rather than trying to make it perfect, or even good, the first time. You saw above how many different systems I have tried before I really found the one that works for me.

2 Likes