Coder of Salvation™ — programming / opensource / console / minimal
Coffeescript is not for everybody.
Just write coffeescript in .js-files
select the coffeescript
or easily toggle between
How to code both..at the same time?
Install the tools using
npm install -g js2coffee coffee-script
put this in your
" easy expansion to js (>) and compressing to coffeescript (<)
vmap c< :!js2coffee<CR>
vmap c> :!coffee --no-header -b -p -s<CR>
nmap c< ggVG:!js2coffee<CR>
nmap c> ggVG:!coffee --no-header -b -p -s<CR>:%s/};/};^M/g<CR>
nmap cc :! [[ \! -f %:r.coffee ]] && js2coffee % > %:r.coffee<CR>:sp %:r.coffee<CR>
Selections are handy when you don't want
.coffee files in your repo (*)
open a .js-file, code some lines of coffeescript
now select those lines using
c< to convert the selection to coffeescript
* = eventhough this is the adviced approach for modules, there are reasons to not want
.coffee-files in your repo (clean commits).
Example: switching / converting files
recommended: open a .js-file, and create/jump-to the
.coffee-file by typing:
This is awesome:
Also check out the vim plugin for coffeescript](https://github.com/kchmck/vim-coffee-script). The
:CoffeeWatch command is pretty handy.
comments powered by
All rights reserved by Leon van Kammen under this license