![]() ![]() ![]() The all setting determines how Snibbets handles files containing multiple snippets. Optionally adjust the extension setting if you use an extension other than md (e.g. Set the source key to the folder where you keep your Markdown snippets. Name_only: false output: raw source: "~/Dropbox/Snippets " Snippet Location InstallationĮxtension: md highlight: false include_blockquotes: false interactive: true launchbar: false menus: If neither are available, a basic Readline menu system will be displayed, so neither are required, just nice to have as they provide fuzzy filtering, scrolling, and type-ahead completion. If available, menus are generated by fzf or gum. On macOS and most other systems, you can also use something like Homebrew, rbenv, rvm, or asdf to install Ruby 3. You can install it via the Command Line Tools from Apple. On recent versions of macOS, this is not included by default. It makes it easy to search for snippets in nvUltra, and also allows you to do searches like snibbets tag:javascript url parser with Snibbets. I mostly use this for adding tags, which are then synced to macOS tags when I save. You can include MultiMarkdown metadata in your snippets, either in a YAML block or just at the top of the file with raw key/value pairs. name "rc.conf" -exec chmod o r '' \ įinds files older than 18months and newer than 24 months, cats the output to a CSV in the format `/some/path/somewhere, size in bytes, Access Time, Modified Time`įind /dir/dir -type f -mtime +540 -mtime -720 -printf \"%p\",\"%s\",\"%AD\",|"%TD\" If you want a note to be included in console output, make it a blockquote by preceding it with >.įind. ![]() Notes are not output on the console, only the code is displayed. Additional descriptions and notes can be included outside of the code block. If a file contains multiple snippets, they should be separated by ATX-style headers (one or more #) describing the snippets. (And if you have fzf or gum installed, you can quickly filter through with fuzzy searching and find exactly what you need.) Those (ATX) headers are used to split the file, and when you search from the command line, you'll get a menu of all of the snippets in the selected file. That file contains an array of useful snippets, and each one has a descriptive title in an h3 header above it. For example, I have a file called 'Ruby hash snippets.rb.md'. You can combine multiple snippets in a file, though. If I got the snippet from StackOverflow, I give it a name based on the question I searched to find it. Call it 'javascript url parser.js.md' or similar. The name of the file should be the description of the snippet, at least in the case where there's only one snippet in the document. This can aid in searching and makes it easy to script things like adding language tags automatically. For example, a css snippet would be *.css.md, a ruby snippet would be *.rb.md. I recommend using filenames with multiple extensions (ending with your markdown extension), primarily to define the syntax for a snippet. Each Markdown file can have somewhat flexible formatting, as long as there's at least one code block (either indented by 4 spaces/1 tab or fenced with backticks). Snibbets is designed to work with a folder containing Markdown files. It's basically a wrapper for find and grep with the ability to separate code blocks from other text in my Markdown files. What Snibbets does is simply allow a quick search for a specific snippet that I can either output to the terminal, pipe to my clipboard, or access via LaunchBar (via the included LaunchBar Action). I can add descriptive names and extended descriptions/notes to code snippets using standard Markdown. I can collect and edit my snippets using a text editor, nvALT (nvUltra), or simply by saving snippets from my clipboard to a text file using *NIX redirection on the command line. Snibbets allows me to keep code snippets in raw files, not relying on a dedicated code snippet app. A tool for accessing code snippets contained in a folder of plain text Markdown files. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |