官术网_书友最值得收藏!

CoffeeScript support in the editor

Let's add support for CoffeeScript to your favorite text editor. This step is optional, but I heartily recommend it. At a minimum, these plugins will provide syntax highlighting for CoffeeScript files, which I find very helpful. In addition, most plugins integrate with the editor to allow you to run or compile CoffeeScript snippets without leaving the editor. You don't need these features, but you may find them convenient.

Tip

We'll discuss CoffeeScript support in some of the most popular editors, but there are plugins available for many more. A full list is available on the CoffeeScript wiki at https://github.com/jashkenas/coffee-script/wiki/Text-editor-plugins/.

Follow the instructions to install CoffeeScript in your editor of choice. After installing, restart your editor and try it out by opening setup.coffee. You will see some simple syntax highlighting on the code we just wrote to indicate that the plugin is working correctly.

Support in TextMate

Jeremy Ashkenas, the creator of CoffeeScript, has written a TextMate bundle that provides syntax highlighting, snippets, and inline compilation. Visit the project homepage at https://github.com/jashkenas/coffee-script-tmbundle and follow the installation instructions.

Support in Sublime Text 2

Sublime Text users have several choices available for CoffeeScript support.

One option is to use parts of the TextMate bundle. To use this, create a CoffeeScript directory in Sublime Text's plugin directory (on OS X, this is found at ~/Library/Application Support/Sublime Text 2). Then, download the bundle, extract Syntaxes/CoffeeScript.tmLanguage and Preferences/CoffeeScript.tmPreferences and place these files in the new directory. To simplify the process, you can download these two files directly using the following URLs:

The other option is to use the native Sublime Text plugin for CoffeeScript. This offers more features and is built specifically for Sublime Text. Visit the project homepage at http://xavura.github.io/CoffeeScript-Sublime-Plugin/ and follow the installation instructions.

Support in Vim

A Vim script is available that provides syntax highlighting as well as a :CoffeeCompile command to compile CoffeeScript on the fly. Visit the project homepage at https://github.com/kchmck/vim-coffee-script/ and follow the installation instructions.

Tip

The official repository for this plugin may be abandoned by the original maintainer, and there are several annoying bugs that have gone unfixed. You may wish to install a patched version from one of the several active forks of the project instead, such as https://github.com/CITguy/vim-coffee-script/. Follow the provided installation instructions, but be sure to download files from GitHub and not vim.org. Substitute the fork you are using whenever the instructions specify kchmck/vim-coffee-script.

Support in Emacs

There is an Emacs Major Mode named coffee-mode that provides syntax highlighting, menu support, and on-the-fly compiling. Install it from the Emacs package archive, or visit the project homepage at https://github.com/defunkt/coffee-mode for more information.

主站蜘蛛池模板: 宿松县| 松阳县| 新野县| 吴桥县| 蒙阴县| 蓬莱市| 永兴县| 溆浦县| 黎川县| 桂阳县| 中牟县| 宁阳县| 庆安县| 普兰店市| 元氏县| 自贡市| 全南县| 离岛区| 陆河县| 民权县| 武城县| 略阳县| 如东县| 海原县| 莒南县| 绵阳市| 肃宁县| 瓦房店市| 西平县| 杂多县| 兴安县| 来凤县| 洛扎县| 巨鹿县| 龙南县| 民丰县| 达日县| 台东县| 高邑县| 志丹县| 漾濞|