Ⅰ. 插件描述
JavaScript to CoffeeScript from the comfort of your Vim bufferⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jarrodctaylor/vim-js2coffee'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jarrodctaylor/vim-js2coffee'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jarrodctaylor/vim-js2coffee'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jarrodctaylor/vim-js2coffee
Ⅳ. 文档说明
# vim-js2coffee
JavaScript to CoffeeScript and CoffeeScript to JavaScript from the comfort of your vim buffer.
Demo

INSTALLATION
Use your plugin manager of choice.
git clone https://github.com/JarrodCTaylor/vim-js2coffee ~/.vim/bundle/vim-js2coffee
- Add
Bundle 'https://github.com/JarrodCTaylor/vim-js2coffee'to .vimrc - Run
:BundleInstall
- Add
- Add
NeoBundle 'https://github.com/JarrodCTaylor/vim-js2coffee'to .vimrc - Run
:NeoBundleInstall
- Add
- Add
Plug 'https://github.com/JarrodCTaylor/vim-js2coffee'to .vimrc - Run
:PlugInstall
- Add
REQUIREMENTS
You need a VIM version that was compiled with python support, which is typical
for most distributions on Linux/Mac. You can check this by runningvim --version | grep +python
if you get a hit you are in business.
You will need to npm install js2coffee and coffee-script to preform the actual compilation. Make
sure that you have access to both js2coffee and coffee from your shell in order for this plugin
to be able to function.
Usage
The plugin provides four commands:
JSBuffer2Coffee
JSSelection2Coffee
CoffeeBuffer2JS
CoffeeSelection2JS
For ease of usage you can map the above actions to a shortcut. For example,
if you wanted leader mappings you could set something like the following in
your vimrc:
nnoremap<Leader>bc :CoffeeBuffer2JS<CR>
nnoremap<Leader>sc :CoffeeSelection2JS<CR>
nnoremap<Leader>bj :JSBuffer2Coffee<CR>
nnoremap<Leader>bs :JSSelection2Coffee<CR>