The nvUltra beta even has a new feature that allows tab completion of subfolders when creating a new file, so my snippets notebook can have language-specific subfolders to which I can easily assign new snippets. This is an extension to nvUltra for me I still edit (and search) my snippets in nvUltra. If you’re interested, I made a repository for it: /ttscoff/Snibbets. It’s not overly developed at this point, a simple combination of find and grep with a parser that will extract code blocks automatically. It’s a CLI (with accompanying LaunchBar Action) that lets me quickly search for code snippets by filename and content. The flexibility and scriptability of this system is demonstrated in a tool I created called Snibbets. This is useful when parsing the files for import to other apps, or for use with tools like… Snibbets for your Snippets Files that contain multiple snippets get ATX (#) headers that describe each snippet. The code itself gets separated from context using Markdown formatting, either with indentation or backtick fences. If the snippet came from StackExchange or a blog post, I’ll usually include the surrounding text as context. For example, “Launch App with arguments.m.md” would signify that it’s an Objective-C snippet that, well, you get the idea. I tend to give my snippets descriptive file names, and include the language as an additional extension. In nvUltra (which I promise even those not in the beta will see soon) I have a dedicated notebook for snippets, I can use subfolders in addition to tags to group code (both in metadata and macOS tags on the files, synced together), and nvUltra has superior tag searching and filtering (including AND/OR boolean combinations). I also kept all of my snippets in the same folder as my other notes, distinguishing them with a snippet tag. In nvALT I relied entirely on tags and filenames to separate by language and category, and nvALT’s tag search is, well, not great. And with Markdown formatting I can include all the notes I need to right in with the code. With a little tagging and consistent naming conventions I never can’t find the snippet I’m looking for. It’s always been as fast or faster for me to search my snippets in nvALT than to go through whatever snippet app I’m trying at any given time. The whole point of nvALT (and nvUltra, if you’re lucky enough to be in the beta) is that you have all of your notes stored as plain text, easily searched and edited. Which, for me, is always plain text.īy the way, if you ever need to convert a bunch of Markdown files to Quiver’s JSON format, let me know, I have just the script for you. Granted, most people won’t switch apps as often as I have, but the fact that it’s a pain in the butt to do so illustrates the benefit of keeping everything in as close to a universal format as possible. It’s easier to have a simple format like Markdown that I can just write out to the new format when needed. Rarely do snippet apps offer the ability to import from other snippet managers, and even when their storage format is simple JSON or XML, it still takes some scripting to get field names and formatting switched over. Storing everything in a snippet app’s database format has bitten me almost every time. Storing everything in Markdown has never bitten me. As plain text, they’re portable and highly flexible. Here’s the thing: this folder full of Markdown files has been ported to every snippet manager I’ve tried, either by direct import or via a script I create to read them in and write them to the snippet app’s format. Portability, Portability, PortabilityĬode is always plain text, why would I want to put it into a database format to work with it? I think I’ve tried just about every solution out there (I think Quiver and SnippetsLab are excellent applications), but I always come back to keeping all of my snippets in a folder of Markdown files. I’ve been trying out and letting go of code snippet managers since the early days of Code Collector Pro.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |