24552f02259829428c412a88729de4cfd0b7ba8b

Author
Cooper Maruyama <cooperm@susteen.com>
Committer
Cooper Maruyama <cooperm@susteen.com>
Date

Message

Add readme and add new alias cfpc: paste+compile+copy

Diff

 1diff --git a/plugins/coffee/README b/plugins/coffee/README
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..d0e7bbe74b59716d99bdd103c7f229d8b1119ebb
 4--- /dev/null
 5+++ b/plugins/coffee/README
 6@@ -0,0 +1,31 @@
 7+## Coffeescript Plugin
 8+
 9+This plugin provides aliases for quickly compiling and previewing your
10+cofeescript code.
11+
12+When writing Coffeescript it's very common to want to preview the output of a
13+certain snippet of code, either because you want to test the output or because
14+you'd like to execute it in a browser console which doesn't accept Coffeescript.
15+
16+Preview the compiled result of your coffeescript with `cf "code"` as per the
17+following:
18+
19+```zsh
20+$ cf 'if a then be else c'
21+if (a) {
22+  b;
23+} else {
24+  c;
25+}
26+```
27+
28+Also provides the following aliases:
29+
30+* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
31+           to run the code in a JS console.
32+
33+* **cfp:** Compiles from your currently copied clipboard. Useful when you want 
34+           to compile large/multi-line snippets
35+
36+* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
37+            the result back to clipboard.
38diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh
39index be34b03c2898d533a635b2f8d83a2f4f63825606..1a7bedd87fe9426f18c00e9f99bbc269a194406d 100644
40--- a/plugins/coffee/coffee.plugin.zsh
41+++ b/plugins/coffee/coffee.plugin.zsh
42@@ -11,3 +11,6 @@ cfc () {
43 
44 # compile from pasteboard & print
45 alias cfp='coffeeMe "$(pbpaste)"'
46+
47+# compile from pasteboard and copy to clipboard
48+alias cfpc='cfp | pbcopy'