• Stars
    star
    439
  • Rank 99,247 (Top 2 %)
  • Language
    CoffeeScript
  • Created almost 12 years ago
  • Updated 24 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.

Project Status

                                         __
   __     _____     ___     ___    __  _/\_\
 /'__`\  /\ '__`\  / __`\ /' _ `\ /\ \/'\/\ \
/\ \L\.\_\ \ \L\ \/\ \L\ \/\ \/\ \\/>  </\ \ \
\ \__/.\_\\ \ ,__/\ \____/\ \_\ \_\/\_/\_\\ \_\
 \/__/\/_/ \ \ \/  \/___/  \/_/\/_/\//\/_/ \/_/
            \ \_\
             \/_/


 ____            __    __
/\  _`\         /\ \__/\ \__
\ \ \L\ \     __\ \ ,_\ \ ,_\    __   _ __
 \ \  _ <'  /'__`\ \ \/\ \ \/  /'__`\/\`'__\
  \ \ \L\ \/\  __/\ \ \_\ \ \_/\  __/\ \ \/
   \ \____/\ \____\\ \__\\ \__\ \____\\ \_\
    \/___/  \/____/ \/__/ \/__/\/____/ \/_/


		                ___    ___                                                __
		              /'___\ /'___\                                    __        /\ \__
		  ___    ___ /\ \__//\ \__/   __     __    ____    ___   _ __ /\_\  _____\ \ ,_\
		 /'___\ / __`\ \ ,__\ \ ,__\/'__`\ /'__`\ /',__\  /'___\/\`'__\/\ \/\ '__`\ \ \/
		/\ \__//\ \L\ \ \ \_/\ \ \_/\  __//\  __//\__, `\/\ \__/\ \ \/ \ \ \ \ \L\ \ \ \_
		\ \____\ \____/\ \_\  \ \_\\ \____\ \____\/\____/\ \____\\ \_\  \ \_\ \ ,__/\ \__\
		 \/____/\/___/  \/_/   \/_/ \/____/\/____/\/___/  \/____/ \/_/   \/_/\ \ \/  \/__/
		                                                                      \ \_\
		                                                                       \/_/

Jump to Section

Overview

This package is for Sublime Text 3. If you are looking for Sublime Text 2, then please refer to st2 branch here.

Description

CoffeeScript plug-in was originally created by @Xavura. As I began writing a lot of code in CoffeeScript, I felt the need for side-by-side view for compiled CoffeeScript. Since Xavura's repository have been inactive I decided to branch out my own version. The biggest change in my branch is the Watch Mode which updates the compiled JavaScript view whenever you modify the CoffeeScript thus enabling you to view your progress side-by-side.

I use this plug-in almost everyday! Therefore, whenever I am not developing I am in testing. I'll do my best to make sure every request or bug will be answered since I'm a frequent user.

Contributing

  • Please use aponxi/issues page to make requests or report bugs.
  • Please make pull requests to the respective branch (master branch is for Sublime Text 3, st2 branch is for Sublime Text 2.)

Installation

via Package Control

This is the recommended installation method.

If you have Sublime Package Control, you know what to do. If not, well: it's a package manager for Sublime Text 3. Installation guide can be found here. After installing the package manager:

  • Open the Command Pallete (ctrl+shift+P or cmd+shift+P).
  • Type "Install Package" and hit return.
  • Type "Better CoffeeScript" and hit return.

via Source Control

If you plan to contribute, then you should install via this method. Otherwise it is recommended that you install the package via Package Control, see above.

Sublime stores packages in the following locations:

Nix: ~/.config/sublime-text-3/packages
Mac: ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
Win: %APPDATA%\Sublime Text 3\Packages

As a repository within the packages directory

Open a Terminal/Console and run the following commands, replacing PACKAGE_PATH with the path corresponding to your OS above.

cd PACKAGE_PATH
git clone https://github.com/aponxi/sublime-better-coffeescript.git "Better CoffeeScript"

As a repository outside of the packages directory

If you use Github for Mac/Windows which store repositories in a specific location, or if you just don't want a repository in your packages directory, then instead you can use a link.

If you don't yet have the repository, then grab it via your GUI program or via the command line:

cd WHEREVER_YOU_WANT
git clone https://github.com/aponxi/sublime-better-coffeescript.git

Once that is done, we will create the link:

Windows:

cd PACKAGE_PATH
mklink /D "Better CoffeeScript" ABSOLUTE_PATH_TO_REPOSITORY

Nix/Mac:

cd PACKAGE_PATH
ln -s ABSOLUTE_PATH_TO_REPOSITORY "Better CoffeeScript"

A note on Package Control

When Package Control tries to update your packages, if you have a repository in your packages directory then it will try to pull down and merge any changes. If you don't want this to happen and would rather handle everything yourself, then you can add the following to your settings (Preferences » Package Settings » Package Control » Settings - User):

"auto_upgrade_ignore": ["Better CoffeeScript"]

Updating

If you are using Package Control, updating will be automatic and you don't have to worry about it.

If using Source Control:

cd "PACKAGE_PATH/Better CoffeeScript"
git fetch origin
git merge origin/master

Commands/Shortcuts

You can access the commands either using the command palette (ctrl+shift+P or cmd+shift+P) or via shortcuts.

alt+shift+t - Run a Cake task
alt+shift+r - Run some CoffeeScript (prints output to a panel on the bottom)
alt+shift+s - Run a syntax check
alt+shift+c - Compile a file
alt+shift+d - Display compiled JavaScript
alt+shift+l - Display lexer tokens
alt+shift+n - Display parser nodes
alt+shift+w - Toggle watch mode
alt+shift+p - Toggle output panel

Context menu has Compile Output that compiles the current CoffeeScript and outputs the javascript code that is run, in a panel.

Note: Some of the commands use the Status Bar for output, so you'll probably want to enable it (View » Show Status Bar).

Snippets

  • Use TAB to run a snippet after typing the trigger.
  • Use TAB and shift+TAB to cycle forward/backward through fields.
  • Use ESC to exit snippet mode.

Snippet Triggers

Comprehension

Array:  forin
Object: forof
Range:  fori (inclusive)
Range:  forx (exclusive)

Statements

If:        if
Else:      el
If Else:   ifel
Else If:   elif
Switch:    swi
Ternary:   ter
Try Catch: try
Unless:    unl

Classes

Class - cla
Class extends SuperClass - clx

Other

Function:      -
Function:      = (bound)
Interpolation: #

Building

When using the build system, it is assumed that your .sublime-project file lives in your project's base directory (due to limitations with the build system).

Hitting F7 (Tools » Build) will run the Cake task 'sbuild'.

If you're not quite sure what the point of this is then read on.

Let's say before distributing your project that you would like to combine all of your .js files into one and then minify them them using UglifyJS or something.

That's what this is for! You would create a Cakefile and inside it you would write a task:

task 'sbuild', 'Prepare project for distribution.', ->
	# ...

Settings

Go to Preferences > Package Settings > Better CoffeeScript > Settings - User to change settings.

{
	/*
		The directories you would like to include in $PATH environment variable.
		Use this if your node installation is at a separate location and getting errors such as `cannot find node executable`

		example:
		"envPATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

	*/
	"envPATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
	/*
		The directory containing your coffee binary. Usually
		/usr/local/bin.
	*/
	"binDir": "/usr/local/bin"

	/*
		Compile without the top-level function wrapper (coffee -b).
	*/

,	"noWrapper": true

	/*
		Enable or disable refresh the compiled Output on Save.
		Only available for watch mode.
	*/
,	"watchOnSave": true
	/*
		Enable refreshing compiled JS when CoffeeScript is modified.

		Put false to disable
		Put a number of seconds to delay the refresh
	*/
,	"watchOnModified": 0.5
	/*
		Enable Compiling on save. It will compile into the same folder.
	*/
,	"compileOnSave": true
	/*
		## Enable outputting the results of the compiled coffeescript in a panel
	*/
,	"showOutputOnSave": false
	/*
		## Enable compiling to a specific directory.
		#### Description

		if it is a string like 'some/directory' then `-o some/directory` will be added to `coffee` compiler.
		if it is false or not string then it will compile your `script.coffee` to the directory it is in.

		#### Example:
		Directory is relative to the file you are editing if specified such as
			compileDir": "out"
		Directory is absolute if specified such as
			compileDir": "/home/logan/Desktop/out"

	*/
,	"compileDir": false
	/*
		## Enable compiling to a specific relative directories.

		#### Example:
		Set absolute path for compile dir:
			"compileDir": "/home/user/projects/js"
		And specified folders
			"relativeDir": "/home/user/projects/coffee"
			"compilePaths":
			{
				"/home/user/projects/coffee": "/home/user/projects/first/js",
				"/home/user/projects/second/coffee": "../js",
			}

		So
			"/home/user/projects/coffee/app.coffee" will compile to "/home/user/projects/first/js/app.js"
			"/home/user/projects/coffee/models/prod.coffee" will compile to "/home/user/projects/first/js/models/prod.js"
			"/home/user/projects/coffee/second/coffee/app2.coffee" will compile to "/home/user/projects/second/js/app2.js"
			"/home/user/projects/main.coffee" will compile to "/home/user/projects/js/main.js"

	*/
,	"compilePaths": false



}

Project settings

Go to Project > Edit Project to change project settings.

{
	"folders":
	[
		...
	],
	"settings":
	{
		"CoffeeScript":
		{
			"noWrapper": true,
			"compileOnSave": true,
			"compileDir": "out"
		}
	}
}

FAQ

Most of the linux terminal commands written here can be run via cygwin - aka Linux Terminal in Windows.

  • Most of the problems are related to configurations. Remember to configure binDir after you install!

  • Do I have coffee-script installed?

Try finding coffee-script in your global npm list with npm ls -g | grep coffee which will output something like:

npm ls -g | grep coffee

# will output:
#├── [email protected]
#├─┬ [email protected]
#│ ├── [email protected]
#├── UNMET DEPENDENCY generator-coffee *
#│ │ ├── [email protected]
  • Where can I find out the path to coffee binary?

In Linux which command will tell you where a command originates from. In terminal type:

which coffee
# /usr/bin/coffee

This path will go into the binDir setting.

  • I'm getting the error message 'coffee' is not recognized as an internal or external command, when saving.

The coffee-script binary probably is not installed. Either install coffee-script or set checkSyntaxOnSave and compileOnSave to false in Preferences > Package Settings > Better CoffeeScript > Settings - User.

Latest Changelog

v0.7.0 01/June/2013

  • merged st3 with master branch
  • now the sublime text 2 support is in st2 branch
  • fixed the @ highlight in language definitions
  • fixed an error you would get when it was looking for project settings when it wasn't a project we were editing

Special Thanks

Thanks to everyone who has contributed to this project. You guys rock!

  • agibsonsw for his help in writing WatchMode

  • Xavura for writing the base of this plugin and contributing 56 commits / 1,951 ++ / 406 --

  • @lavrton for helping with moderation as well as ontributing 39 commits / 5,009 ++ / 857 --

  • @markalfred for contributing 6 commits / 90 ++ / 48 --

  • @exromany for contributing 5 commits / 71 ++ / 31 --

  • @DaQuirm for contributing 3 commits / 42 ++ / 23 --

  • @ehuss for contributing 2 commits / 2 ++ / 2 --

  • @donovanhide for contributing 2 commits / 16 ++ / 16 --

  • @SunLn for contributing 2 commits / 5 ++ / 5 --

  • @mekf for contributing 2 commits / 15 ++ / 2 --

  • @pyrotechnick for contributing 2 commits / 4 ++ / 3 --

  • @samtsai for contributing 2 commits / 6 ++ / 6 --

  • @szhu for contributing 2 commits / 18 ++ / 15 --

  • @johnogle222 for contributing 1 commit / 7 ++ / 0 --

  • @arjansingh for contributing 1 commit / 8 ++ / 4 --

  • @stared for contributing 1 commit / 1 ++ / 1 --

  • @tomByrer for contributing 1 commit / 1 ++ / 13 --

  • @ppvg for contributing 1 commit / 20 ++ / 27 --

  • @TurtlePie for contributing 1 commit / 1 ++ / 1 --

  • @FichteFoll for contributing 1 commit / 8 ++ / 5 --

  • @daytonn for contributing 1 commit / 1 ++ / 1 --

  • @mfkp for contributing 1 commit / 1 ++ / 1 --

  • @btmills for contributing 1 commit / 3 ++ / 1 --

  • @Whoaa512 for contributing 1 commit / 2 ++ / 2 --

  • @alexdowad for contributing 1 commit / 8 ++ / 2 --

  • @Cryrivers for contributing 1 commit / 1 ++ / 1 --

  • @wbond for contributing 1 commit / 4 ++ / 4 --

  • @nouveller for contributing 1 commit / 0 ++ / 1 --

  • @larvata for contributing 1 commit / 11 ++ / 11 --

  • @ashtuchkin for contributing 1 commit / 36 ++ / 7 --

  • @philippotto for contributing 1 commit / 28 ++ / 1 --

  • @mattschofield for contributing 1 commit / 19 ++ / 0 --

  • @Mitranim for contributing 1 commit / 1 ++ / 1 --

  • @osuushi for contributing 1 commit / 10 ++ / 2 --

  • @radcool for contributing 1 commit / 2 ++ / 2 --

  • @FredyC for contributing 1 commit / 1 ++ / 1 --

Written in Q3 2014

More Repositories

1

Spacegray

A Hyperminimal UI Theme for Sublime Text
JavaScript
7,188
star
2

LaTeXTools

LaTeX plugin for Sublime Text
Python
2,007
star
3

Origami

Split the window however you like! Create new panes, delete panes, move and clone views from pane to pane.
Python
1,208
star
4

CTags

CTags support for Sublime Text
Python
987
star
5

TrailingSpaces

Highlight trailing spaces and delete them in a flash.
Python
897
star
6

AdvancedNewFile

File creation plugin for Sublime Text
Python
828
star
7

PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
Python
436
star
8

VintageEx

An implementation of Vim's command-line mode for Sublime Text 2
Python
381
star
9

PowerShell

Support for the MS PowerShell programming language.
PowerShell
313
star
10

Helium

Let Sublime Text talk with Jupyter.
Python
236
star
11

ColdFusion

ColdFusion Sublime Text Package
Python
197
star
12

VBScript

VBScript package for Sublime Text
Python
185
star
13

WordHighlight

Highlight all copies of the currently selected word.
Python
180
star
14

PhpDoc

PhpDoc support package.
JavaScript
165
star
15

Terraform

Terraform (HCL) configuration file syntax highlighting for Sublime Text
HCL
163
star
16

RSpec

Sublime Text 2 / 3 plugin for RSpec BDD Framework
Python
124
star
17

InsertNums

Sublime Text plugin for inserting sequences. Supporting alphanumerics and hex, with bitwise operations!
Python
123
star
18

UnitTesting

Testing Sublime Text Packages
Python
111
star
19

IndentGuides

Draw vertical guides to easily visualize indent depth.
Python
106
star
20

Mote

SFTP Remote Editing for Sublime Text 2
Python
105
star
21

Pywin32

Pywin32 support for sublime (win32api etc)
Python
81
star
22

ElasticTabstops

Tab characters automatically adjust to keep adjacent lines aligned.
Python
67
star
23

PhpBeautifier

Pear Php_beautifier plugin for Sublime Text 2
Python
66
star
24

SaneSnippets

Sublime Text snippets optimized for humans, not robots
Python
59
star
25

LegacyColorSchemes

Color schemes that were part of Sublime Text 2 and older builds of Sublime Text 3
52
star
26

sublime_lib

Utility library for frequently used functionality in Sublime Text and convenience functions or classes
Python
52
star
27

Theme-DAneo

A theme for Sublime Text 3.2+ inspired by the popular DA UI
Python
51
star
28

Sass

Sass and SCSS syntax for Sublime Text
SCSS
50
star
29

material-theme

Material Theme, a theme for Sublime Text 3, made by Mattia Astorino
Python
44
star
30

GenerateUUID

Generate UUID for Sublime Text
Python
42
star
31

NSIS

Sublime Text plugin for the Nullsoft Scriptable Install System
Shell
40
star
32

WinMerge

Plugin that enables comparison of the last 2 activated buffers (even in different windows) using WinDiff (Windows only).
Python
37
star
33

InactivePanes

Sublime Text plugin that slightly dims (or grays) inactive panes in your group view
Python
32
star
34

SublimeHg

Use Mercurial from Sublime Text.
Python
30
star
35

QML

QML support for Sublime Text and Sublime Merge
QML
28
star
36

StatusBarFileSize

Show the file size in the Sublime Text status bar
Python
27
star
37

TailwindCSS

Tailswind CSS syntax for Sublime Text
CSS
24
star
38

MouseEventListener

Adds on_pre_click and on_post_click callbacks to Sublime Text's plugin API.
JavaScript
24
star
39

Mojolicious

Mojolicious package for the Perl Web Dev Framework for Sublime Text 2
JavaScript
22
star
40

Modelines

Vim-like modelines for Sublime Text.
Python
21
star
41

NaturalDocs

NaturalDocs package for SublimeText 2
JavaScript
21
star
42

ExtractSublimePackage

Extract .sublime-package files to the Sublime Text Packages folder.
Python
20
star
43

RevertFontSize

Sublime Text plugin to quickly revert to a preferred font size
Python
20
star
44

LegacyTheme

Sublime Text 2's default theme with retina graphics
19
star
45

YamlPipelines

Sublime Syntax Definitions for YAML CI/CD pipelines like GitHub Actions, AzureDevops, Kong API Gateway, Gitlab CICD, Bitbucket, Drone CI etc.
Python
18
star
46

KnowledgeBase

Sublime Text Knowledge Base
Python
18
star
47

ScrollOffset

Python
18
star
48

UberSelection

Commands to extend the functionality of Sublime Text's multiselection.
Python
17
star
49

PythonOpenModule

Open python modules on sys.path and open folders in window
Python
16
star
50

PowershellUtils

Run powershell commands from within Sublime Text.
Python
16
star
51

Rake

Sublime Text 2 plugin for Ruby Rake
Python
15
star
52

JumpTo

Sublime Text plugin to move (multiple) cursors
Python
13
star
53

SwitchWindow

A plugin to quickly switch between Sublime Text windows via Command Palette
Python
12
star
54

ScopeNamingGuidelines

Collection of documents for scope naming guidelines in Sublime Text syntax definitions
12
star
55

AutoSelect

Sticky Selection
Python
12
star
56

SublimeCMD

Simple command processor for Sublime Text.
Python
12
star
57

syntax-test-action

Github Action to run syntax tests
Shell
12
star
58

OpenDefaultApplication

Sublime Text plugin to open files in the system default application
Python
11
star
59

Terminal

Launch terminals from the current file or the root project folder
Python
11
star
60

Sublime-Snipt

Sublime Text 2 plugin that will sync with snipt.net
Python
10
star
61

sublimetext.github.io

GitHub Organization for Open-Source Sublime Text Package Development
9
star
62

AutoProjects

A Sublime Text plugin to open folders as projects
Python
9
star
63

PackageTesting

Minimal testing framework for Sublime Text packages. (beta)
Python
8
star
64

WslBuild

A Sublime Text package to create build systems running in WSL2
Python
7
star
65

Astro

Astro syntax for Sublime Text
Astro
7
star
66

TJ3-syntax-sublimetext2

Taskjuggler 3 syntax and code snippets for Sublime Text 2
7
star
67

Mustache

Mustache syntax and snippets for Sublime Text
Mustache
6
star
68

Less

Less syntax for Sublime Text
Less
6
star
69

LINQPad

Syntax highlighting and build system for LINQPad scripts
5
star
70

AlpineJS

AlpineJS syntax for Sublime Text
PHP
4
star
71

Ceedling

Sublime Text plugin for Ceedling C unit testing framework
Python
4
star
72

Gaelyk

Gaelyk Sublime Text Package
3
star
73

GoToEndOfLineOrScope

Sublime Text plugin to bind a key (for example the end key) to move/extend the cursor/selection(s) to the end of the line, or to before the specified scope (i.e. a comment) at the end of the line
Python
3
star
74

RichTextFormat

Syntax definition for RTF files in Sublime Text 3
2
star
75

wbond-packages

Packages created, and (mostly) managed by Will Bond
1
star
76

OpenFileInCurrentFolder

Allows opening of files in the same folder as the active view
Python
1
star