This project adds [CoffeeScript] support to vim. It covers syntax, indenting,
compiling, and more.
![Screenshot](http://i.imgur.com/j1BhpZQ.png)
[CoffeeScript]: http://coffeescript.org/
## Table of Contents
- Installation
- [Requirements](#requirements)
- [Install using Pathogen](#install-using-pathogen)
- [Install using Vundle](#install-using-vundle)
- [Install from a Zip File](#install-from-a-zip-file)
- Coffee Commands
- [Compile to JavaScript](#compile-to-javascript)
- [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets)
- [Live Preview Compiling](#coffeewatch-live-preview-compiling)
- [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets)
- [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript)
- Extras
- [Literate CoffeeScript](#literate-coffeescript)
- [CoffeeScript in HTML](#coffeescript-in-html)
- [CoffeeScript in Haml](#coffeescript-in-haml)
- Configuration
- [Custom Autocmds](#custom-autocmds)
- [Configuration Variables](#configuration-variables)
- [Configure Syntax Highlighting](#configure-syntax-highlighting)
- [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript)
## Requirements
- vim 7.4 or later
- coffee 1.2.0 or later
## Install using Pathogen
This project uses rolling releases based on git commits, so pathogen is a
natural fit for it. If you're already using pathogen, you can skip to step 4.
1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's
readme][install-pathogen] for more information.)
[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332
[install-pathogen]: https://github.com/tpope/vim-pathogen#installation
2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables
all the features of `vim-coffee-script`:
```vim
call pathogen#infect()
syntax enable
filetype plugin indent on
```
If you already have a vimrc built up, just make sure it contains these calls,
in this order.
3. Create the directory `~/.vim/bundle/`:
mkdir ~/.vim/bundle
4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`:
git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/
Updating takes two steps:
1. Change into `~/.vim/bundle/vim-coffee-script/`:
cd ~/.vim/bundle/vim-coffee-script
2. Pull in the latest changes:
git pull
## Install using Vundle
1. [Install Vundle] into `~/.vim/bundle/`.
[Install Vundle]: https://github.com/gmarik/vundle#quick-start
2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all
the features of `vim-coffee-script`:
```vim
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Plugin 'kchmck/vim-coffee-script'
syntax enable
filetype plugin indent on
```
If you're adding Vundle to a built-up vimrc, just make sure all these calls
are in there and that they occur in this order.
3. Open vim and run `:PluginInstall`.
To update, open vim and run `:PluginInstall!` (notice the bang!)
## Install from a Zip File
1. Download the latest zip file from [vim.org][zip].
2. Extract the archive into `~/.vim/`:
unzip -od ~/.vim/ ARCHIVE.zip
This should create the files `~/.vim/autoload/coffee.vim`,
`~/.vim/compiler/coffee.vim`, etc.
You can update the plugin using the same steps.
[zip]: http://www.vim.org/scripts/script.php?script_id=3590
## Compile to JavaScript
A `coffee` wrapper for use with `:make` is enabled automatically for coffee
files if no other compiler is loaded. To enable it manually, run
:compiler coffee
The `:make` command is then configured to use the `coffee` compiler and
recognize its errors. I've included a quick reference here but be sure to check
out [`:help :make`][make] for a full reference of the command.
![make](http://i.imgur.com/scUXmxR.png)
![make Result](http://i.imgur.com/eGIjEdn.png)
[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg
Consider the full signature of a `:make` call as
:[silent] make[!] [COFFEE-OPTIONS]...
By default `:make` shows all compiler output and jumps to the first line
reported as an error. Compiler output can be hidden with a leading `:silent`:
:silent make
Line-jumping can be turned off by adding a bang:
:make!
`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also
[`coffee_make_options`](#coffee_make_options)):
:make --bare --output /some/dir
See the [full table of options](http://coffeescript.org/#usage) for a
list of all the options that `coffee` recognizes.
*Configuration*: [`coffee_compiler`](#coffee_compiler),
[`coffee_make_options`](#coffee_make_options)
#### The quickfix window
Compiler errors are added to the [quickfix] list by `:make`, but the quickfix
window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up
the quickfix window if there are any errors:
:make
:cwindow
This is usually the desired behavior, so you may want to add an autocmd to your
vimrc to do this automatically:
autocmd QuickFixCmdPost * nested cwindow | redraw!
The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but
can removed for gVim.
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow
#### Recompile on write
To recompile a file when it's written, add a `BufWritePost` autocmd to your
vimrc:
autocmd BufWritePost *.coffee silent make!
#### Cake and Cakefiles
A `cake` compiler is also available with the call
:compiler cake
You can then use `:make` as above to run your Cakefile and capture any `coffee`
errors:
:silent make build
It runs within the current directory, so make sure you're in the directory of
your Cakefile before calling it.
*Configuration*: [`coffee_cake`](#coffee_cake),
[`coffee_cake_options`](#coffee_cake_options)
## CoffeeCompile: Compile CoffeeScript Snippets
CoffeeCompile shows how the current file or a snippet of CoffeeScript is
compiled to JavaScript.
:[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE]
Calling `:CoffeeCompile` without a range compiles the whole file:
![CoffeeCompile](http://i.imgur.com/0zFG0l0.png)
![CoffeeCompile Result](http://i.imgur.com/bpiAxaa.png)
Calling it with a range, like in visual mode, compiles only the selected snippet
of CoffeeScript:
![CoffeeCompile Snippet](http://i.imgur.com/x3OT3Ay.png)
![Compiled Snippet](http://i.imgur.com/J02j4T8.png)
Each file gets its own CoffeeCompile buffer, and the same buffer is used for all
future calls of `:CoffeeCompile` on that file. It can be quickly closed by
hitting `q` in normal mode.
Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally
(see also [`coffee_compile_vert`](#coffee_compile_vert)):
:CoffeeCompile vert
By default the CoffeeCompile buffer splits the source buffer in half, but this
can be overridden by passing in a `WINDOW-SIZE`:
:CoffeeCompile 4
*Configuration*: [`coffee_compiler`](#coffee_compiler`),
[`coffee_compile_vert`](#coffee_compile_vert)
#### Quick syntax checking
If compiling a snippet results in a compiler error, CoffeeCompile adds that
error to the [quickfix] list.
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
![Syntax Checking](http://i.imgur.com/RC8accF.png)
![Syntax Checking Result](http://i.imgur.com/gi1ON75.png)
You can use this to quickly check the syntax of a snippet.
## CoffeeWatch: Live Preview Compiling
CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript
homepage][CoffeeScript].
![CoffeeWatch](http://i.imgur.com/TRHdIMG.png)
![CoffeeWatch Result](http://i.imgur.com/rJbOeeS.png)
CoffeeWatch takes the same options as CoffeeCompile:
:CoffeeWatch [vert[ical]] [WINDOW-SIZE]
After a source buffer is watched, leaving insert mode or saving the file fires
off a rec
没有合适的资源?快使用搜索试试~ 我知道了~
linux下vim的自动补全的插件
需积分: 20 32 下载量 3 浏览量
2016-01-02
21:05:21
上传
评论 2
收藏 18.18MB GZ 举报
温馨提示
共2000个文件
vim:554个
sample:414个
head:184个
如果用过sublime,就知道它的自动补全很好用,这个在linux下的vim也可以
资源推荐
资源详情
资源评论
收起资源包目录
linux下vim的自动补全的插件 (2000个子文件)
000ab0a83a2096570a29f6e70a9df17a7ae639 83B
0021e3876b2d5891bd55347b6853794155c55c 165B
0091cfa1f665a65d79f122cfa85d674a3791cb 85B
00fb0d534ef6363b8df9525865310ec6410ae0 110B
00fd176edb367d3e6a327e9fc5dab2929d038e 660B
0189853632a9647a363bec5ad969f9e98a2113 163B
01977d4de94f077417d2e7bdd501a690104628 235B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
019ed081d7980c90948e54e88f4e0e72d4c4b1 238B
020a3c64c2ba2da8e7bde408c181dcb5c32a85 6KB
0215783a9ba09bcba18fbf6bd6bdc72a1fee1a 55B
02a7b10c7168e15f9aa46b92c709569aba5fe8 131B
02aecbb74828217e0e21ec9c7280e707f74b87 332B
02b5926939a73eb8158e720d89cece992bbffe 58B
02c30f63eb3937e2fd0cdf931e0eada563e330 241B
02f80ba5650794f53851d24998c4097c2f49f7 163B
02fc10f5985c890c442d1de6b2598c9218f08a 1KB
0311de47077d58bb25fe4db317edd77be11999 219B
0386c16c569083b4e76e16c66a7e88f2c7996e 141B
03ee904fea9f3c1778d6088d9f2c9c3f1cd911 180B
047e8cfb144770ba2d10d174f592040c0d7446 2KB
048e0f8d3fd195d9f7edfaba6f575421d4326c 173B
04ccf280e2b1f064c09b251169b0124dc40d14 128B
04dfbd7d38e5d90f26a3f0569c81ae0d75ed84 304B
04e6c078fa4cc944385c53bcfc67a19acff0f8 180B
05032c6c31beb2267485fbc74ce0d3c49b8e50 79B
05a5c131edefcafe0685f9bb854f0afc151e7e 329B
0626a32933e11305ff10d4ad05ce253eef9d22 53B
06294f8d06a6ad1efac2ca427a06d44b034b0b 148B
0685418667d26b3b387fb97fca5c6a1fc7dbb6 242B
0687359a47caaef398d0578edf2557c69fd3dc 130B
06a4cdf6db1a97da86def09869e2b39908b31c 128B
074c8f3745fada348899fbdd6d54e1121d25f6 235B
07886ccf7de25087761e884c4bed886ac74d6e 178B
07a5386ebb5e138286d81cf19dbf29310c896c 60B
0800a40356be464ca4ab9f22011bc63c5547be 6KB
080ea042fa27af34e3cbee4298a0b1468cc924 59B
08e70a9e06d14163bbd4843a00138bda3962d4 57B
08ec77c48f76eee44639a87ba5f8bfd909f2da 11KB
0932a49d2de583b22a089213c3574a80d9ca5d 727B
0963169983f4ff5764aee68ee3febb4a6fd014 128B
09c2205a7c0c35b8a1d549946985f5cd0669dc 58B
0a0fad0386138c85c3a44e5329ae58b7d6b235 3KB
0ac222fa1481078d854e81c6e177508f0055e1 155B
0b8cd0cc7379ebe88cfba5c83244b21b46d82a 60B
0ba8b8d19394930febda0ed8d0f346df96b62d 130B
0c3c60f0e5fb5a47aaa388272216f1f824f302 159B
0c3e880742a7b4a79c8483ef684a8f60762d93 55B
0c4da28db308ee4be8404deb00d01073824749 2KB
0c757459e614bc15e4c0a7f7b517cda5dbb790 3KB
0c90b72d302f7c22f8f6d351781de8c76e6fb6 952B
0d5a0105039eddc03691c1791e06d86cf08e44 287B
0da6de5af7c6f42ceb1ec8b7cc015955a3955a 129B
0dca961da7cd9580cb4b7b92de55ace956367a 161B
0de859a782049a39bd655d6525975eea92eb37 129B
0e079f7c43427d461220187b05a3aa1d249adc 84B
0e095351d458f4f2731ff80ea16d2f5090f00c 130B
0e97f00070a5a903fa554b19af00b90aecc139 165B
0f031fad3a0e08effb2fe6278d03f3687f697d 111B
0f5e087a4cb6affc3e50b31be742b6583077e3 2KB
0fb2dbbdee2729a7de6770ec6c08fedd4628d5 218B
1028aa2a600cdb3b7300dc3439f5cd9491a66d 55B
10411d28a7beb6d8dcfdae73160f722955dc0e 218B
10a235639ccbd4207bf852ee251ca902ccd0be 55B
10b3cd481d438050fa8b5a94f45e33793f1046 1KB
10e6b6a692aaa1f96745db10fa5e96f60e901f 54B
111d42dc318aebdc4f618f7d378ed8596fb6bc 110B
1126759c2ae4545d1626234f4aba02ae0a262f 1KB
11a781059ac1df02be425a95df5924ad57047d 1KB
11b30c7ea9d997d7a7ac83b94a5a04325d4dad 180B
129f1dafc9e5fd8fcd7f7c428d75cc54818f90 173B
12b2beeebc6155270708a7c4cbb8f7d8a8aa27 127B
12d89441a90a7b56bbd4619f77c30bd7a6b896 56B
13ac3cc885d6794def5c347afdbf2183dc9abb 219B
13b7d0e7f1ecbddca92ddc82627f110e3a3781 305B
141f87e6b6f093c2120ca42a5da5590be4490e 164B
1478c7354fb58bb86b67f717e8b867d1b6cf96 119B
14934fde769e2e71341ef5d9520111c22b9cbe 130B
149a136ff7faafb03818c7c8a8527c1f5c631b 83B
14c115a932ec101c7de1ab9454d67007b0578a 55B
15c6cf81c3fa853d76e35e66eac3c53165c034 427B
15d6d5a50ce9f1d8982eb6d43fef34ab82fa1f 354B
161b24ed7e21215d0c9959a4602cc3655a01b0 57B
1625e911f2dca6f6e42a65dd077a51871c568c 128B
1660477e9d8c8a3180bb348b94665b3f8eb8cd 56B
167f1a8c539cac36fcdc5609edb8fbeda439cc 62B
16940acda5eeb2cd52424ec78f98e61dbff988 812B
173d42a46f040270d904ab18ce2b3ac7a24e37 56B
1753e2062f61d4cd20dc6ee7257ff9fd7a74cd 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
lotluck
- 粉丝: 167
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功