From 8e8cdc0502fc35844975548fa268e7ed027d00b7 Mon Sep 17 00:00:00 2001 From: Cooper Maruyama Date: Fri, 1 May 2015 01:34:20 -0700 Subject: Add coffeescript aliases: cf, cfc, cfp cf: compile and show output cfc: compile & copy cfp: compile from pasteboard & print --- plugins/coffee/coffee.plugin.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/coffee/coffee.plugin.zsh diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh new file mode 100644 index 000000000..96393f66d --- /dev/null +++ b/plugins/coffee/coffee.plugin.zsh @@ -0,0 +1,13 @@ +#!/bin/zsh + +# compile a string of coffeescript and print to output +cf () { + coffee -peb $1 +} +# compile & copy to clipboard +cfc () { + cf $1 | tail -n +2 | pbcopy +} + +# compile from pasteboard & print +alias cfp='coffeeMe "$(pbpaste)"' -- cgit v1.2.3-70-g09d2 From a315ddc075e6a6a4b9dbdcaced0fa08349597223 Mon Sep 17 00:00:00 2001 From: Cooper Maruyama Date: Fri, 1 May 2015 01:37:55 -0700 Subject: typofix --- plugins/coffee/coffee.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh index 96393f66d..be34b03c2 100644 --- a/plugins/coffee/coffee.plugin.zsh +++ b/plugins/coffee/coffee.plugin.zsh @@ -6,7 +6,7 @@ cf () { } # compile & copy to clipboard cfc () { - cf $1 | tail -n +2 | pbcopy + cf $1 | pbcopy } # compile from pasteboard & print -- cgit v1.2.3-70-g09d2 From 24552f02259829428c412a88729de4cfd0b7ba8b Mon Sep 17 00:00:00 2001 From: Cooper Maruyama Date: Sat, 2 May 2015 07:14:21 -0700 Subject: Add readme and add new alias cfpc: paste+compile+copy --- plugins/coffee/README | 31 +++++++++++++++++++++++++++++++ plugins/coffee/coffee.plugin.zsh | 3 +++ 2 files changed, 34 insertions(+) create mode 100644 plugins/coffee/README diff --git a/plugins/coffee/README b/plugins/coffee/README new file mode 100644 index 000000000..d0e7bbe74 --- /dev/null +++ b/plugins/coffee/README @@ -0,0 +1,31 @@ +## Coffeescript Plugin + +This plugin provides aliases for quickly compiling and previewing your +cofeescript code. + +When writing Coffeescript it's very common to want to preview the output of a +certain snippet of code, either because you want to test the output or because +you'd like to execute it in a browser console which doesn't accept Coffeescript. + +Preview the compiled result of your coffeescript with `cf "code"` as per the +following: + +```zsh +$ cf 'if a then be else c' +if (a) { + b; +} else { + c; +} +``` + +Also provides the following aliases: + +* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want + to run the code in a JS console. + +* **cfp:** Compiles from your currently copied clipboard. Useful when you want + to compile large/multi-line snippets + +* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the + the result back to clipboard. diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh index be34b03c2..1a7bedd87 100644 --- a/plugins/coffee/coffee.plugin.zsh +++ b/plugins/coffee/coffee.plugin.zsh @@ -11,3 +11,6 @@ cfc () { # compile from pasteboard & print alias cfp='coffeeMe "$(pbpaste)"' + +# compile from pasteboard and copy to clipboard +alias cfpc='cfp | pbcopy' -- cgit v1.2.3-70-g09d2 From d80918bf981d5df3f192346b44c0c35636ee7b2b Mon Sep 17 00:00:00 2001 From: Cooper Maruyama Date: Sat, 2 May 2015 07:16:27 -0700 Subject: add markdown extension to README --- plugins/coffee/README | 31 ------------------------------- plugins/coffee/README.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 plugins/coffee/README create mode 100644 plugins/coffee/README.md diff --git a/plugins/coffee/README b/plugins/coffee/README deleted file mode 100644 index d0e7bbe74..000000000 --- a/plugins/coffee/README +++ /dev/null @@ -1,31 +0,0 @@ -## Coffeescript Plugin - -This plugin provides aliases for quickly compiling and previewing your -cofeescript code. - -When writing Coffeescript it's very common to want to preview the output of a -certain snippet of code, either because you want to test the output or because -you'd like to execute it in a browser console which doesn't accept Coffeescript. - -Preview the compiled result of your coffeescript with `cf "code"` as per the -following: - -```zsh -$ cf 'if a then be else c' -if (a) { - b; -} else { - c; -} -``` - -Also provides the following aliases: - -* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want - to run the code in a JS console. - -* **cfp:** Compiles from your currently copied clipboard. Useful when you want - to compile large/multi-line snippets - -* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the - the result back to clipboard. diff --git a/plugins/coffee/README.md b/plugins/coffee/README.md new file mode 100644 index 000000000..d0e7bbe74 --- /dev/null +++ b/plugins/coffee/README.md @@ -0,0 +1,31 @@ +## Coffeescript Plugin + +This plugin provides aliases for quickly compiling and previewing your +cofeescript code. + +When writing Coffeescript it's very common to want to preview the output of a +certain snippet of code, either because you want to test the output or because +you'd like to execute it in a browser console which doesn't accept Coffeescript. + +Preview the compiled result of your coffeescript with `cf "code"` as per the +following: + +```zsh +$ cf 'if a then be else c' +if (a) { + b; +} else { + c; +} +``` + +Also provides the following aliases: + +* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want + to run the code in a JS console. + +* **cfp:** Compiles from your currently copied clipboard. Useful when you want + to compile large/multi-line snippets + +* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the + the result back to clipboard. -- cgit v1.2.3-70-g09d2