snibbets 2.0.13 → 2.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md.orig +12 -0
- data/Gemfile.lock +4 -1
- data/README.md +5 -1
- data/README.md.orig +186 -0
- data/lib/snibbets/config.rb +1 -0
- data/lib/snibbets/highlight.rb +27 -16
- data/lib/snibbets/lexers.rb +2 -1
- data/lib/snibbets/lexers_db.rb +379 -0
- data/lib/snibbets/version.rb +1 -1
- data/lib/snibbets.rb +2 -2
- data/snibbets.gemspec +1 -0
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98b13afd70724c3aa6daab71756c261aa79ad37346c649870061181ab8f99b60
|
4
|
+
data.tar.gz: b0e3a0c0ff67b4682ed8586ccde22c348d530064a631e4212f2ebd187f493180
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60d90cb35caa5c87b5155c6619321983ecc9499d0bd95977bab1247cd4ff45c3fffeb14ea2c1495c07ae7759f29e0e36e187891e78032c357499f87819856fcc
|
7
|
+
data.tar.gz: 8f5401783340973160e443699186b521b1f1b7c9d43f381c6b0c374aac9a1c60e5aef77df54780e2326f7e7fa06b2cc3afa8500103c421c1fefc5552d16150bd
|
data/CHANGELOG.md.orig
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snibbets (2.0.
|
4
|
+
snibbets (2.0.14)
|
5
5
|
tty-which (~> 0.5, >= 0.5.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -82,6 +82,9 @@ GEM
|
|
82
82
|
PLATFORMS
|
83
83
|
arm64-darwin-20
|
84
84
|
arm64-darwin-21
|
85
|
+
ruby
|
86
|
+
x64-mingw32
|
87
|
+
x86_64-darwin-20
|
85
88
|
x86_64-linux
|
86
89
|
|
87
90
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
|
2
|
+
|
3
|
+
[![RubyGems.org](https://img.shields.io/gem/v/snibbets)](https://rubygems.org/gems/snibbets)
|
4
|
+
<!-- [![GitHub Actions](https://github.com/ttscoff/snibbets/actions/workflows/check.yml/badge.svg)](https://github.com/ttscoff/snibbets/actions/workflows/check.yml) -->
|
5
|
+
|
2
6
|
A tool for accessing code snippets contained in a folder of plain text Markdown files.
|
3
7
|
|
4
8
|
Snibbets allows me to keep code snippets in raw files, not relying on a dedicated code snippet app. 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. I can add descriptive names and extended descriptions/notes to code snippets using standard Markdown.
|
@@ -117,7 +121,7 @@ The `name_only` key will permanently set Snibbets to only search for snippets by
|
|
117
121
|
### Usage
|
118
122
|
|
119
123
|
```
|
120
|
-
Snibbets v2.0.
|
124
|
+
Snibbets v2.0.14
|
121
125
|
|
122
126
|
Usage: snibbets [options] query
|
123
127
|
-a, --all If a file contains multiple snippets, output all of them (no menu)
|
data/README.md.orig
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
[![RubyGems.org](https://img.shields.io/gem/v/snibbets)](https://rubygems.org/gems/snibbets)
|
4
|
+
<<<<<<< HEAD
|
5
|
+
[![GitHub Actions](https://github.com/ttscoff/snibbets/actions/workflows/check.yml/badge.svg)](https://github.com/ttscoff/snibbets/actions/workflows/check.yml)
|
6
|
+
=======
|
7
|
+
<!-- [![GitHub Actions](https://github.com/ttscoff/snibbets/actions/workflows/check.yml/badge.svg)](https://github.com/ttscoff/snibbets/actions/workflows/check.yml) -->
|
8
|
+
>>>>>>> develop
|
9
|
+
|
10
|
+
A tool for accessing code snippets contained in a folder of plain text Markdown files.
|
11
|
+
|
12
|
+
Snibbets allows me to keep code snippets in raw files, not relying on a dedicated code snippet app. 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. I can add descriptive names and extended descriptions/notes to code snippets using standard Markdown.
|
13
|
+
|
14
|
+
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). It's basically a wrapper for `find` and `grep` with the ability to separate code blocks from other text in my Markdown files.
|
15
|
+
|
16
|
+
|
17
|
+
![Snibbets in action](https://cdn3.brettterpstra.com/uploads/2023/04/snibbets2.gif)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## Collecting Snippets
|
22
|
+
|
23
|
+
Snibbets is designed to work with a folder containing Markdown files. 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).
|
24
|
+
|
25
|
+
I recommend using filenames with multiple extensions (ending with your markdown extension), primarily to define the syntax for a snippet. For example, a css snippet would be `*.css.md`, a ruby snippet would be `*.rb.md`. This can aid in searching and makes it easy to script things like adding language tags automatically.
|
26
|
+
|
27
|
+
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. Call it 'javascript url parser.js.md' or similar. If I got the snippet from StackOverflow, I give it a name based on the question I searched to find it. Be descriptive.
|
28
|
+
|
29
|
+
You can combine multiple snippets in a file, though. For example, I have a file called 'Ruby hash snippets.rb.md'. That file contains an array of useful snippets, and each one has a descriptive title in an h3 header above it. 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. (And if you have [fzf](https://github.com/junegunn/fzf) or [gum](https://github.com/charmbracelet/gum) installed, you can quickly filter through with fuzzy searching and find exactly what you need.)
|
30
|
+
|
31
|
+
If a file contains multiple snippets, they should be separated by ATX-style headers (one or more `#`) describing the snippets. Additional descriptions can be included outside of the code block. For example:
|
32
|
+
|
33
|
+
A file titled `unix find.bash.md`:
|
34
|
+
|
35
|
+
title: Unix find commands
|
36
|
+
tags: bash, shell, unix
|
37
|
+
|
38
|
+
### Find by name and execute command
|
39
|
+
|
40
|
+
find . -name "rc.conf" -exec chmod o r '{}' \;
|
41
|
+
|
42
|
+
### Find by name and grep contents
|
43
|
+
|
44
|
+
find . -name "*.php" -exec grep -H googleapis '{}' \;
|
45
|
+
|
46
|
+
### Find by age range to CSV
|
47
|
+
|
48
|
+
Finds 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`
|
49
|
+
|
50
|
+
find /dir/dir -type f -mtime +540 -mtime -720 -printf \"%p\",\"%s\",\"%AD\",|"%TD\"\\n > /dir/dir/output.csv
|
51
|
+
|
52
|
+
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. I mostly use this for adding tags, which are then synced to macOS tags when I save. It makes it easy to search for snippets in [nvUltra](https://nvultra.com/), and also allows you to do searches like `snibbets tag:javascript url parser` in Snibbets.
|
53
|
+
|
54
|
+
## CLI
|
55
|
+
|
56
|
+
### Dependencies
|
57
|
+
|
58
|
+
Snibbets requires Ruby 3.0+. On recent versions of macOS, this is not included by default. You can install it via the Command Line Tools from Apple. On macOS and most other systems, you can use something like [Homebrew], [rbenv], [rvm], or [asdf] to install Ruby 3.
|
59
|
+
|
60
|
+
If available, menus are generated by [fzf] or [gum]. 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.
|
61
|
+
|
62
|
+
[homebrew]: https://brew.sh/ "Homebrew???The Missing Package Manager for macOS (or Linux)"
|
63
|
+
[rbenv]: https://github.com/rbenv/rbenv "rbenv/rbenv:Manage your app's Ruby environment"
|
64
|
+
[rvm]: https://rvm.io/ "Ruby Version Manager"
|
65
|
+
[asdf]: https://asdf-vm.com/ "ASDF environment manager"
|
66
|
+
[fzf]: https://github.com/junegunn/fzf "junegunn/fzf:A command-line fuzzy finder"
|
67
|
+
[gum]: https://github.com/charmbracelet/gum "charmbracelet/gum:A tool for glamorous shell scripts ????"
|
68
|
+
|
69
|
+
### Installation
|
70
|
+
|
71
|
+
To install Snibbets:
|
72
|
+
|
73
|
+
gem install snibbets
|
74
|
+
|
75
|
+
If you're using the system Ruby, you may need to use `sudo gem install snibbets`.
|
76
|
+
|
77
|
+
### Configuration
|
78
|
+
|
79
|
+
When you run it the first time, Snibbets will write a configuration file to `~/.config/snibbets/snibbets.yml`. You can edit that file to set things like your snippets directory, your preferred file extension, and a few other options. Options specified in the config file can always be overriden on the command line with flags.
|
80
|
+
|
81
|
+
Once an editor is defined, you can use `snibbets --configure` to open it automatically. Running that commmand before configuring an editor will use whatever app/utility your system defaults to for YAML files.
|
82
|
+
|
83
|
+
Default config:
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
---
|
87
|
+
all: false
|
88
|
+
copy: false
|
89
|
+
editor:
|
90
|
+
extension: md
|
91
|
+
highlight: false
|
92
|
+
include_blockquotes: false
|
93
|
+
interactive: true
|
94
|
+
launchbar: false
|
95
|
+
menus:
|
96
|
+
name_only: false
|
97
|
+
output: raw
|
98
|
+
source: "~/Dropbox/Snippets"
|
99
|
+
```
|
100
|
+
|
101
|
+
#### Snippet Location
|
102
|
+
|
103
|
+
Set the `source` key to the folder where you keep your Markdown snippets. Optionally adjust the `extension` setting if you use an extension other than `md` (e.g. `markdown` or `txt`).
|
104
|
+
|
105
|
+
#### Other Options
|
106
|
+
|
107
|
+
The `all` setting determines how Snibbets handles files containing multiple snippets. If `all` is true, then it will always display every snippet in the selected file. If false, it will offer a menu and let you choose which snippet to display. You can use `--all` on the command line to just enable this once.
|
108
|
+
|
109
|
+
The `copy` setting determines whether the output is copied to the clipboard in addition to being displayed on STDOUT. This is the equivalent of running `snibbets QUERY | pbcopy` (macOS) or `snibbets QUERY | xclip` (Linux). This can be enabled for just one run with `--copy` on the command line. Setting it to true in the config will copy to the clipboard every time a snippet is displayed. On Mac this will work automatically, on Windows/Linux you may need to [install `xclip` or `xsel`][xclip].
|
110
|
+
|
111
|
+
[xclip]: https://ostechnix.com/access-clipboard-contents-using-xclip-and-xsel-in-linux/
|
112
|
+
|
113
|
+
The `editor` setting is used to open the config file, and to open snippets for editing when using the `--edit` flag. This setting can be any command line utility (`code`, `subl`, `vim`, `nano`, etc.), or on macOS it can be an application name (`BBEdit`, `VS Code`, etc.) or a bundle identifier (`com.sublimetext.4`, `com.microsoft.VSCode`, etc.). If no editor is set, then the file will be opened by whatever the system default is (using `open` on macOS, `start` on Windows, or `xdg-open`on Linux).
|
114
|
+
|
115
|
+
The `highlight` key turns on syntax highlighting. This requires that either `pygmentize` or `skyligting` is available on your system (both available via package managers like Homebrew). This feature is still in development and results may be mixed.
|
116
|
+
|
117
|
+
The `include_blockquotes` setting determines whether blockquotes are included in the output. By default, Snibbets removes everything other than code blocks (indented or fenced) from the output it displays. But if you want to include a note that you'll see on the command line, you can put it in a block quote by preceding each line you want to preserve with a right angle bracket (`>`).
|
118
|
+
|
119
|
+
The `interactive` setting determines whether menus will be displayed. This should generally be true, but if you want silent operation that just displays the best match automatically, set it to false.
|
120
|
+
|
121
|
+
The `menus` setting will determine what method is used for displaying interactive menus. If this is not set, it will be automatically determined in the order of `fzf`, `gum`, and `console`. You can manually choose to use one of these options over another by making it the `menus` setting.
|
122
|
+
|
123
|
+
The `name_only` key will permanently set Snibbets to only search for snippets by their filename rather than examining their contents. You can enable this at runtime using `--name-only` in the command.
|
124
|
+
|
125
|
+
### Usage
|
126
|
+
|
127
|
+
```
|
128
|
+
Snibbets v2.0.14
|
129
|
+
|
130
|
+
Usage: snibbets [options] query
|
131
|
+
-a, --all If a file contains multiple snippets, output all of them (no menu)
|
132
|
+
-c, --[no-]copy Copy the output to the clibpoard (also displays on STDOUT)
|
133
|
+
-e, --edit Open the selected snippet in your configured editor
|
134
|
+
-n, --[no-]name-only Only search file names, not content
|
135
|
+
-o, --output FORMAT Output format (json|launchbar|*raw)
|
136
|
+
-p, --paste, --new Interactively create a new snippet from clipboard contents (Mac only)
|
137
|
+
-q, --quiet Skip menus and display first match
|
138
|
+
-s, --source FOLDER Snippets folder to search
|
139
|
+
--configure Open the configuration file in your default editor
|
140
|
+
--[no-]blockquotes Include block quotes in output
|
141
|
+
--highlight Use pygments or skylighting to syntax highlight (if installed)
|
142
|
+
--save Save the current command line options to the YAML configuration
|
143
|
+
-h, --help Display this screen
|
144
|
+
-v, --version Display version information
|
145
|
+
```
|
146
|
+
|
147
|
+
If your Snippets folder is set in the config, simply running `snibbets [search query]` will perform the search and output the code blocks, presenting a menu if more than one match is found or the target file contains more than one snippet. Selected contents are output raw to STDOUT.
|
148
|
+
|
149
|
+
> If you have fzf or gum installed, snibbets will use those for menus, providing fuzzy filtering of options.
|
150
|
+
|
151
|
+
#### JSON output
|
152
|
+
|
153
|
+
An undocumented output option is `-o json`, which will output all of the matches and their code blocks as a JSON string that can be incorporated into other scripts. It's similar to the `-o launchbar` option, but doesn't contain the extra keys required for the LaunchBar action.
|
154
|
+
|
155
|
+
#### Open snippets in your editor
|
156
|
+
|
157
|
+
Use the `--edit` flag on any search to open the found snippet file in your editor. Configure your default editor in the config file. `snibbets configure` will open that, but if you don't have an editor set, it might have strange results. To edit manually, open `~/.config/snibbets/snibbets.yml` in your text editor of choice.
|
158
|
+
|
159
|
+
#### Creating new snippets
|
160
|
+
|
161
|
+
I do most of my snippet editing in [nvUltra], but sometimes I have a function in my clipboard that just needs quick saving and there are so few moving parts to creating a snippet that it just feels like they could be automated/simplified. That's why I added the `--paste` flag. If you have a code snippet in your clipboard, you can just run `snibbets --paste` (or just `-p`) and you'll get a prompt asking you to describe the snippet (used for filename) and one asking what language(s) are represented.
|
162
|
+
|
163
|
+
You can input the languages as names, e.g. `rust`, `typescript`, or `scala`, or you can just add file extensions that represent the language. If I say `ts` to that prompt, it will generate an extension of `.ts.md` and then add a metadata tag of `typescript` to the file. The code from the clipboard goes into a fenced code block in the document. You can always go add notes to it later, but it's a great way to save snippets as you come across them (or solutions you figure out after a week of banging your head).
|
164
|
+
|
165
|
+
This command requires that a clipboard utility be available. On macOS, you have `pbpaste` by default and don't need to do anything. On Windows and Linux, you'll need to [install either `xclip` or `xsel`][xclip].
|
166
|
+
|
167
|
+
[nvUltra]: https://nvultra.com "nvUltra for Mac"
|
168
|
+
|
169
|
+
|
170
|
+
#### Saving Settings When Running
|
171
|
+
|
172
|
+
Any time you specify things like a source folder with the `--source` flag, or turn on highlighting or name-only search, you can add the flag `--save` to write those to your config and make them the default options.
|
173
|
+
|
174
|
+
## LaunchBar Action
|
175
|
+
|
176
|
+
_I'm currently reworking the LaunchBar action, and it doesn't function very well at this time. I'll update when I have a chance._
|
177
|
+
|
178
|
+
### Installation
|
179
|
+
|
180
|
+
The LaunchBar action can be installed simply by double clicking the `.lbaction` file in Finder. The CLI is not required for the LaunchBar action to function.
|
181
|
+
|
182
|
+
Once installed, run the action (type `snib` and hit return on the result) to select your Snippets folder.
|
183
|
+
|
184
|
+
### Usage
|
185
|
+
|
186
|
+
Type `snib` to bring the Action up, then hit Space to enter your query text. Matching files will be presented. If the selected file contains more than one snippet, a list of snippets (based on ATX headers in the file) will be presented as a child menu. Selecting a snippet and hitting return will copy the associated code block to the clipboard.
|
data/lib/snibbets/config.rb
CHANGED
data/lib/snibbets/highlight.rb
CHANGED
@@ -1,26 +1,37 @@
|
|
1
1
|
module Snibbets
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
module Highlight
|
3
|
+
class << self
|
4
|
+
def highlight_pygments(executable, code, syntax, theme)
|
5
|
+
syntax = syntax.empty? ? '-g' : "-l #{syntax}"
|
6
|
+
`echo #{Shellwords.escape(code)} | #{executable} -O full,style=#{theme} #{syntax}`
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
def highlight_skylight(executable, code, syntax, theme)
|
10
|
+
return code if syntax.empty?
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
`echo #{Shellwords.escape(code)} | #{executable} -t lib/breeze-dark.theme --syntax #{syntax}`
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
def highlight(code, filename, theme = 'monokai')
|
16
|
+
syntax = Lexers.syntax_from_extension(filename)
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
skylight = TTY::Which.which('skylighting')
|
19
|
+
pygments = TTY::Which.which('pygmentize')
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
if Snibbets.options[:highlighter] =~ /^s/ && skylight
|
22
|
+
return highlight_skylight(skylight, code, syntax, theme)
|
23
|
+
elsif Snibbets.options[:highlighter] =~ /^p/ && !pygments.empty?
|
24
|
+
return highlight_pygments(pygments, code, syntax, theme)
|
25
|
+
else
|
26
|
+
if !skylight.empty?
|
27
|
+
return highlight_skylight(skylight, code, syntax, theme)
|
28
|
+
elsif !pygments.empty?
|
29
|
+
return highlight_pygments(pygments, code, syntax, theme)
|
30
|
+
end
|
31
|
+
end
|
22
32
|
|
23
|
-
|
33
|
+
code
|
34
|
+
end
|
24
35
|
end
|
25
36
|
end
|
26
37
|
end
|
data/lib/snibbets/lexers.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require_relative 'lexers_db'
|
2
3
|
|
3
4
|
module Snibbets
|
4
5
|
# Lexer definitions
|
@@ -10,7 +11,7 @@ module Snibbets
|
|
10
11
|
|
11
12
|
def build_lexers
|
12
13
|
lex = []
|
13
|
-
|
14
|
+
LEXERS_DB.split(/\n/).each do |line|
|
14
15
|
key = line.match(/(?mi)^((, )?[^,]+?)+?(?=\[)/)[0]
|
15
16
|
keys = key.split(/,/).map(&:strip)
|
16
17
|
value = line.match(/\[(.*?)\]/)[1]
|
@@ -0,0 +1,379 @@
|
|
1
|
+
LEXERS_DB =<<EOLEXERS
|
2
|
+
abap [abap, ABAP]
|
3
|
+
abnf [abnf]
|
4
|
+
actionscript, as [as]
|
5
|
+
ada [adb, ads, ada]
|
6
|
+
adl [adl, adls, adlf, adlx]
|
7
|
+
agda [agda]
|
8
|
+
aheui [aheui]
|
9
|
+
alloy [als]
|
10
|
+
ambienttalk [at]
|
11
|
+
amdgpu [isa]
|
12
|
+
ampl [run]
|
13
|
+
ansys [ans]
|
14
|
+
apache [.htaccess, apache.conf, apache2.conf]
|
15
|
+
apl [apl, aplf, aplo, apln, aplc, apli, dyalog]
|
16
|
+
applescript [applescript]
|
17
|
+
arduino [ino]
|
18
|
+
arrow [arw]
|
19
|
+
asc [asc]
|
20
|
+
pem [pem, id_dsa, id_ecdsa, id_ecdsa_sk, id_ed25519, id_ed25519_sk, id_rsa]
|
21
|
+
aspectj [aj]
|
22
|
+
aspx-vb [aspx, asax, ascx, ashx, asmx, axd]
|
23
|
+
asymptote, asy [asy]
|
24
|
+
augeas [aug]
|
25
|
+
autohotkey, ahk [ahk, ahkl]
|
26
|
+
autoit [au3]
|
27
|
+
awk [awk]
|
28
|
+
bare [bare]
|
29
|
+
shell [sh, ksh, bash, zsh]
|
30
|
+
batch [bat, cmd]
|
31
|
+
bbcbasic [bbc]
|
32
|
+
bc [bc]
|
33
|
+
befunge [befunge]
|
34
|
+
bibtex [bib]
|
35
|
+
blitzbasic [bb, decls]
|
36
|
+
blitzmax [bmx]
|
37
|
+
bnf [bnf]
|
38
|
+
boa [boa]
|
39
|
+
boo [boo]
|
40
|
+
boogie [bpl]
|
41
|
+
brainfuck, bf [bf, b]
|
42
|
+
bst [bst]
|
43
|
+
c-objdump [c-objdump]
|
44
|
+
c [c, h, idc]
|
45
|
+
ca65 [s]
|
46
|
+
cadl [cadl]
|
47
|
+
cddl [cddl]
|
48
|
+
ceylon [ceylon]
|
49
|
+
cfc [cfc]
|
50
|
+
cf3 [cf]
|
51
|
+
cfm [cfm, cfml]
|
52
|
+
chaiscript, chai [chai]
|
53
|
+
chapel, chpl [chpl]
|
54
|
+
charmci [ci]
|
55
|
+
cheetah, spitfire [tmpl, spt]
|
56
|
+
cirru [cirru]
|
57
|
+
clay [clay]
|
58
|
+
clean [icl, dcl]
|
59
|
+
clojure, clj [clj]
|
60
|
+
clojurescript, cljs [cljs]
|
61
|
+
cmake [cmake, CMakeLists.txt]
|
62
|
+
cobol [cob, cpy]
|
63
|
+
cobolfree [cbl]
|
64
|
+
coffeescript, coffee-script, coffee [coffee]
|
65
|
+
common-lisp, cl [cl]
|
66
|
+
lisp [lisp]
|
67
|
+
componentpascal, cp [cp, cps]
|
68
|
+
coq [v]
|
69
|
+
cpp, c++ [cpp, hpp, c++, h++, cc, hh, cxx, hxx, C, H, cp, CPP]
|
70
|
+
cpp-objdump, c++-objdumb, cxx-objdump [cpp-objdump, c++-objdump, cxx-objdump]
|
71
|
+
cpsa [cpsa]
|
72
|
+
cr, crystal [cr]
|
73
|
+
crmsh, pcmk [crmsh, pcmk]
|
74
|
+
croc [croc]
|
75
|
+
cryptol, cry [cry]
|
76
|
+
csharp, c# [cs]
|
77
|
+
csound, csound-orc [orc, udo]
|
78
|
+
csound-document, csound-csd [csd]
|
79
|
+
csound-score, csound-sco [sco]
|
80
|
+
css [css]
|
81
|
+
cuda, cu [cu, cuh]
|
82
|
+
cypher [cyp, cypher]
|
83
|
+
cython, pyx, pyrex [pyx, pxd, pxi]
|
84
|
+
d [d, di]
|
85
|
+
dart [dart]
|
86
|
+
dasm16 [dasm16, dasm]
|
87
|
+
delphi, pas, pascal, objectpascal [pas, dpr]
|
88
|
+
devicetree, dts [dts, dtsi]
|
89
|
+
dg [dg]
|
90
|
+
diff, udiff [diff, patch]
|
91
|
+
docker, dockerfile [Dockerfile, docker]
|
92
|
+
dpatch [dpatch, darcspatch]
|
93
|
+
dtd [dtd]
|
94
|
+
jbst [duel, jbst]
|
95
|
+
dylan-console, dylan-repl [dylan-console]
|
96
|
+
dylan-lid, lid [lid, hdp]
|
97
|
+
dylan [dylan, dyl, intr]
|
98
|
+
earl-grey, earlgrey, eg [eg]
|
99
|
+
easytrieve [ezt, mac]
|
100
|
+
ebnf [ebnf]
|
101
|
+
ec [ec, eh]
|
102
|
+
ecl [ecl]
|
103
|
+
eiffel [e]
|
104
|
+
elixir, ex, exs [ex, eex, exs, leex]
|
105
|
+
elm [elm]
|
106
|
+
emacs-lisp, elisp, emacs [el]
|
107
|
+
email, eml [eml]
|
108
|
+
erb [erb]
|
109
|
+
erl [erl-sh]
|
110
|
+
erlang [erl, hrl, es, escript]
|
111
|
+
evoque [evoque]
|
112
|
+
execline [exec]
|
113
|
+
extempore [xtm]
|
114
|
+
ezhil [n]
|
115
|
+
factor [factor]
|
116
|
+
fan [fan]
|
117
|
+
fancy, fy [fy, fancypack]
|
118
|
+
felix, flx [flx, flxh]
|
119
|
+
fennel, fnl [fnl]
|
120
|
+
fish, fishshell [fish, load]
|
121
|
+
floscript, flo [flo]
|
122
|
+
forth [frt, fs]
|
123
|
+
fortran [f03, f90, F03, F90]
|
124
|
+
fortranfixed [f, F]
|
125
|
+
foxpro, vfp, clipper, xbase [PRG, prg]
|
126
|
+
freefem [edp]
|
127
|
+
fsharp, f# [fs, fsi]
|
128
|
+
fstar [fst, fsti]
|
129
|
+
futhark [fut]
|
130
|
+
gap [g, gd, gi, gap]
|
131
|
+
gas, asm [s, S]
|
132
|
+
gcode [gcode]
|
133
|
+
gdscript, gd [gd]
|
134
|
+
genshi, kid, xml+genshi, xml+kid [kid]
|
135
|
+
gherkin, cucumber [feature]
|
136
|
+
glsl [vert, frag, geo]
|
137
|
+
gnuplot [plot, plt]
|
138
|
+
go, golang [go]
|
139
|
+
golo [golo]
|
140
|
+
gooddata-cl [gdc]
|
141
|
+
gosu [gs, gsx, gsp, vark]
|
142
|
+
graphviz, dot [gv, dot]
|
143
|
+
groff, nroff, man [man]
|
144
|
+
groovy [groovy, gradle]
|
145
|
+
gsql [gsql]
|
146
|
+
gst [gst]
|
147
|
+
haml [haml]
|
148
|
+
haskell, hs [hs]
|
149
|
+
haxe, hxsl, hx [hx, hxsl]
|
150
|
+
haxeml, hxml [hxml]
|
151
|
+
hlsl [hlsl, hlsli]
|
152
|
+
hsail, hsa [hsail]
|
153
|
+
handlebars [handlebars, hbs]
|
154
|
+
html+ng2 [ng2]
|
155
|
+
html+php [phtml]
|
156
|
+
html+twig [twig]
|
157
|
+
html [html, htm, xhtml, xslt]
|
158
|
+
hybris, hy [hy, hyb]
|
159
|
+
hylang [hy]
|
160
|
+
i6t [i6t]
|
161
|
+
idl [pro]
|
162
|
+
idris, idr [idr]
|
163
|
+
igor, igorpro [ipf]
|
164
|
+
inform6, i6 [inf]
|
165
|
+
inform7, i7 [ni, i7x]
|
166
|
+
ini, cfg, dosini [ini, cfg, inf, service, socket, device, mount, automount, swap, target, path, timer, slice, scope]
|
167
|
+
io [io]
|
168
|
+
ioke, ik [ik]
|
169
|
+
isabelle [thy]
|
170
|
+
j [ijs]
|
171
|
+
jags [jag, bug]
|
172
|
+
jasmin, jasminxt [j]
|
173
|
+
java [java]
|
174
|
+
javascript, js [js, jsm, mjs, cjs]
|
175
|
+
jcl [jcl]
|
176
|
+
jsgf [jsgf]
|
177
|
+
jslt [jslt]
|
178
|
+
json, json-object [json]
|
179
|
+
jsonld, json-ld [jsonld]
|
180
|
+
jsp [jsp]
|
181
|
+
julia, jl [jl]
|
182
|
+
juttle [juttle]
|
183
|
+
kal [kal]
|
184
|
+
kmsg, dmesg [kmsg, dmesg]
|
185
|
+
koka [kk, kki]
|
186
|
+
kotlin [kt, kts]
|
187
|
+
kuin [kn]
|
188
|
+
lasso, lassoscript [lasso]
|
189
|
+
lean [lean]
|
190
|
+
less [less]
|
191
|
+
limbo [b]
|
192
|
+
liquid [liquid]
|
193
|
+
literate-agda, lagda [lagda]
|
194
|
+
literate-cryptol, lcryptol, lcry [lcry]
|
195
|
+
literate-haskell, lhaskell, lhs [lhs]
|
196
|
+
literate-idris, lidris, lidr [lidr]
|
197
|
+
livescript, live-script [ls]
|
198
|
+
llvm-mir [mir]
|
199
|
+
llvm [ll]
|
200
|
+
logos [x, xi, xm, xmi]
|
201
|
+
logtalk [lgt, logtalk]
|
202
|
+
lsl [lsl]
|
203
|
+
lua [lua, wlua]
|
204
|
+
make, makefile, mf, bsdmake [mak, mk, Makefile, makefile, Makefile. GNUmakefile]
|
205
|
+
mako [mao]
|
206
|
+
maql [maql]
|
207
|
+
markdown, md [md, markdown, mmd]
|
208
|
+
mask [mask]
|
209
|
+
mason [m, mhtml, mc, mi, autohandler, dhandler]
|
210
|
+
mathematica, mma, nb [nb, cdf, nbp, ma]
|
211
|
+
miniscript, ms [ms]
|
212
|
+
modelica [mo]
|
213
|
+
modula2, m2 [def, mod]
|
214
|
+
monkey [monkey]
|
215
|
+
monte [mt]
|
216
|
+
moocode, moo [moo]
|
217
|
+
moonscript, moon [moon]
|
218
|
+
mosel [mos]
|
219
|
+
mscgen, msc [msc]
|
220
|
+
mupad [mu]
|
221
|
+
mxml [mxml]
|
222
|
+
myghty [myt, autodelegate]
|
223
|
+
ncl [ncl]
|
224
|
+
nemerle [n]
|
225
|
+
nesc [nc]
|
226
|
+
nestedtext, nt [nt]
|
227
|
+
newlisp [lsp, nl, kif]
|
228
|
+
newspeak [ns2]
|
229
|
+
nimrod, nim [nim, nimrod]
|
230
|
+
nit [nit]
|
231
|
+
nixos, nix [nix]
|
232
|
+
nsis, nsi, nsh [nsi, nsh]
|
233
|
+
nusmv [smv]
|
234
|
+
objdump [objdump]
|
235
|
+
objective-c++, objectivec++, obj-c++, objc++ [mm, hh]
|
236
|
+
objective-c, objectivec, obj-c, objc [m, h]
|
237
|
+
objective-j, objectivej, obj-j, objj [j]
|
238
|
+
ocaml [ml, mli, mll, mly]
|
239
|
+
odin [odin]
|
240
|
+
omg-idl [idl, pidl]
|
241
|
+
ooc [ooc]
|
242
|
+
opa [opa]
|
243
|
+
openedge, abl, progress [p, cls]
|
244
|
+
pacmanconf [pacman.conf]
|
245
|
+
pan [pan]
|
246
|
+
parasail [psi, psl]
|
247
|
+
pawn [p, pwn, inc]
|
248
|
+
peg [peg]
|
249
|
+
perl, pl [pl, pm, t, perl]
|
250
|
+
php [php, inc]
|
251
|
+
pig [pig]
|
252
|
+
pike [pike, pmod]
|
253
|
+
pkgconfig [pc]
|
254
|
+
pointless [ptls]
|
255
|
+
pony [pony]
|
256
|
+
postscript, postscr [ps, eps]
|
257
|
+
pot, po [pot, po]
|
258
|
+
pov [pov, inc]
|
259
|
+
powershell, pwsh, posh, ps1, psm1 [ps1, psm1]
|
260
|
+
praat [praat, proc, psc]
|
261
|
+
prolog [ecl, prolog, pro, pl]
|
262
|
+
promql [promql]
|
263
|
+
properties, jproperties [properties]
|
264
|
+
protobuf, proto [proto]
|
265
|
+
pug [pug]
|
266
|
+
jade [jade]
|
267
|
+
puppet [pp]
|
268
|
+
py2tb [py2tb]
|
269
|
+
pypylog, pypy [pypylog]
|
270
|
+
pytb, py3tb [pytb, py3tb]
|
271
|
+
python, py, sage [py, pyw, jy, sage, sc, bzl, tac]
|
272
|
+
qbasic, basic [BAS, bas]
|
273
|
+
qml, qbs [qml, qbs]
|
274
|
+
qvto, qvt [qvto]
|
275
|
+
racket, rkt [rkt, rktd, rktl]
|
276
|
+
reasonml, reason [re, rei]
|
277
|
+
rebol [r, r3, reb]
|
278
|
+
red [red, reds]
|
279
|
+
redcode [cw]
|
280
|
+
registry [reg]
|
281
|
+
restructuredtext, rst, rest [rst, rest]
|
282
|
+
rexx, arexx [rexx, rex, rx, arexx]
|
283
|
+
rhtml [rhtml]
|
284
|
+
ride [ride]
|
285
|
+
rng-compact, rnc [rnc]
|
286
|
+
roboconf-graph [graph]
|
287
|
+
roboconf-instances [instances]
|
288
|
+
robotframework [robot]
|
289
|
+
rql [rql]
|
290
|
+
rsl [rsl]
|
291
|
+
ruby, rb [rb, rbw, rake, gemspec, rbx, duby]
|
292
|
+
rust, rs [rs, rs.in]
|
293
|
+
sarl [sarl]
|
294
|
+
sas [SAS, sas]
|
295
|
+
sass [sass, scss]
|
296
|
+
scala [scala]
|
297
|
+
scaml [scaml]
|
298
|
+
scdoc, scd [scd, scdoc]
|
299
|
+
scheme, scm [scm, ss]
|
300
|
+
scilab [sci, sce, tst]
|
301
|
+
sgf [sgf]
|
302
|
+
shen [shen]
|
303
|
+
shexc, shex [shex]
|
304
|
+
sieve [siv, sieve]
|
305
|
+
silver [sil, vpr]
|
306
|
+
slash [sla]
|
307
|
+
slim [slim]
|
308
|
+
slurm, sbatch [sl]
|
309
|
+
smali [smali]
|
310
|
+
smalltalk, squeak, st [st]
|
311
|
+
smarty [tpl]
|
312
|
+
smithy [smithy]
|
313
|
+
sml [sml, sig, fun]
|
314
|
+
snobol [snobol]
|
315
|
+
snowball [sbl]
|
316
|
+
solidity [sol]
|
317
|
+
sp [sp]
|
318
|
+
sparql [rq, sparql]
|
319
|
+
spec [spec]
|
320
|
+
r [R]
|
321
|
+
sql [sql]
|
322
|
+
ssp [ssp]
|
323
|
+
stan [stan]
|
324
|
+
stata, do [do, ado]
|
325
|
+
supercollider, sc [sc, scd]
|
326
|
+
swift [swift]
|
327
|
+
swig [swg, i]
|
328
|
+
systemverilog, sv [sv, svh]
|
329
|
+
tads3 [t]
|
330
|
+
tap [tap]
|
331
|
+
tasm [tasm]
|
332
|
+
tcl [tcl, rvt]
|
333
|
+
tcsh, csh [tcsh, csh]
|
334
|
+
tea [tea]
|
335
|
+
teal [teal]
|
336
|
+
teratermmacro, teraterm, ttl [ttl]
|
337
|
+
termcap [termcap, termcap.src]
|
338
|
+
terminfo [terminfo, terminfo.src]
|
339
|
+
terraform, tf [tf]
|
340
|
+
tex, latex [tex, aux, toc]
|
341
|
+
text [txt]
|
342
|
+
thrift [thrift]
|
343
|
+
ti, thingsdb [ti]
|
344
|
+
tid [tid]
|
345
|
+
tnt [tnt]
|
346
|
+
trafficscript, rts [rts]
|
347
|
+
treetop [treetop, tt]
|
348
|
+
turtle [ttl]
|
349
|
+
typescript, ts [ts]
|
350
|
+
typoscript [typoscript]
|
351
|
+
ucode [u, u1, u2]
|
352
|
+
urbiscript [u]
|
353
|
+
usd, usda [usd, usda]
|
354
|
+
vala, vapi [vala, vapi]
|
355
|
+
vb.net, vbnet [vb, bas]
|
356
|
+
vbscript [vbs, VBS]
|
357
|
+
vcl [vcl]
|
358
|
+
velocity [vm, fhtml]
|
359
|
+
verilog, v [v]
|
360
|
+
vgl [rpf]
|
361
|
+
vhdl [vhdl, vhd]
|
362
|
+
vim [vim, .vimrc, .exrc, .gvimrc, _vimrc, _exrc, _gvimrc, vimrc, gvimrc]
|
363
|
+
wast, wat [wat, wast]
|
364
|
+
wdiff [wdiff]
|
365
|
+
webidl [webidl]
|
366
|
+
whiley [whiley]
|
367
|
+
x10, xten [x10]
|
368
|
+
xml [xml, xsl, rss, xslt, xsd, wsdl, wsf]
|
369
|
+
xquery, xqy, xq, xql, xqm [xqy, xquery, xq, xql, xqm]
|
370
|
+
xslt [xsl, xslt, xpl]
|
371
|
+
xtend [xtend]
|
372
|
+
yaml+jinja, salt, sls [sls]
|
373
|
+
yaml [yaml, yml]
|
374
|
+
yang [yang]
|
375
|
+
zeek [zeek]
|
376
|
+
bro [bro]
|
377
|
+
zephir [zep]
|
378
|
+
zig [zig]
|
379
|
+
EOLEXERS
|
data/lib/snibbets/version.rb
CHANGED
data/lib/snibbets.rb
CHANGED
@@ -253,7 +253,7 @@ module Snibbets
|
|
253
253
|
warn header
|
254
254
|
warn '-' * header.length
|
255
255
|
code = snip['code']
|
256
|
-
code = highlight(code, filepath) if Snibbets.options[:highlight]
|
256
|
+
code = Highlight.highlight(code, filepath) if Snibbets.options[:highlight]
|
257
257
|
print(code)
|
258
258
|
end
|
259
259
|
end
|
@@ -300,7 +300,7 @@ module Snibbets
|
|
300
300
|
warn header
|
301
301
|
warn '-' * header.length
|
302
302
|
code = answer['code']
|
303
|
-
code = highlight(code, filepath) if Snibbets.options[:highlight]
|
303
|
+
code = Highlight.highlight(code, filepath) if Snibbets.options[:highlight]
|
304
304
|
print(code)
|
305
305
|
end
|
306
306
|
end
|
data/snibbets.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables << 'snibbets'
|
29
29
|
|
30
30
|
spec.files = Dir["lib/**/*.rb"].reject { |f| f.end_with?("_spec.rb") }
|
31
|
+
spec.files += Dir["lib/lexers/lexers_db.txt"]
|
31
32
|
spec.files += Dir["[A-Z]*"]
|
32
33
|
|
33
34
|
spec.add_development_dependency "bundler", "~> 2.0"
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snibbets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2023-04-16 00:00:00.000000000 Z
|
@@ -174,22 +174,22 @@ dependencies:
|
|
174
174
|
name: tty-which
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
|
-
- - ">="
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: 0.5.0
|
180
177
|
- - "~>"
|
181
178
|
- !ruby/object:Gem::Version
|
182
179
|
version: '0.5'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 0.5.0
|
183
183
|
type: :runtime
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- - ">="
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: 0.5.0
|
190
187
|
- - "~>"
|
191
188
|
- !ruby/object:Gem::Version
|
192
189
|
version: '0.5'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 0.5.0
|
193
193
|
description: A plain text code snippet manager
|
194
194
|
email: me@brettterpstra.com
|
195
195
|
executables:
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- Gemfile.lock.orig
|
206
206
|
- LICENSE.txt
|
207
207
|
- README.md
|
208
|
+
- README.md.orig
|
208
209
|
- README.rdoc
|
209
210
|
- Rakefile
|
210
211
|
- bin/snibbets
|
@@ -215,6 +216,7 @@ files:
|
|
215
216
|
- lib/snibbets/hash.rb
|
216
217
|
- lib/snibbets/highlight.rb
|
217
218
|
- lib/snibbets/lexers.rb
|
219
|
+
- lib/snibbets/lexers_db.rb
|
218
220
|
- lib/snibbets/menu.rb
|
219
221
|
- lib/snibbets/os.rb
|
220
222
|
- lib/snibbets/string.rb
|
@@ -230,7 +232,7 @@ metadata:
|
|
230
232
|
bug_tracker_uri: https://github.com/ttscoff/snibbets/issues
|
231
233
|
changelog_uri: https://github.com/ttscoff/snibbets/blob/main/CHANGELOG.md
|
232
234
|
github_repo: git@github.com:ttscoff/snibbets.git
|
233
|
-
post_install_message:
|
235
|
+
post_install_message:
|
234
236
|
rdoc_options:
|
235
237
|
- "--title"
|
236
238
|
- na
|
@@ -252,8 +254,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
254
|
- !ruby/object:Gem::Version
|
253
255
|
version: '0'
|
254
256
|
requirements: []
|
255
|
-
rubygems_version: 3.
|
256
|
-
signing_key:
|
257
|
+
rubygems_version: 3.2.16
|
258
|
+
signing_key:
|
257
259
|
specification_version: 4
|
258
260
|
summary: Snibbets
|
259
261
|
test_files: []
|