I'm relatively new to Vim (from TextMate), and have been using kchmck's Vim coffeescript plugin. It's great, but I miss being able to cmd-R in TextMate to run snippets of coffeescript using jashkenas's TextMate bundle. Anyone have any tips on setting this up with Vim?
I have no experience with CoffeeScript but from your second link I gather that your document is given to a coffee
command.
Did you try :!coffe %
?
:!
to run an external command,coffee
the external command,%
expanded by Vim at the time of execution, represents the current file.EDIT
Add this to your .vimrc
:
nnoremap <D-r> :!coffee %<CR>
nnoremap
the mapping works in normal mode only,<D-r>
is Cmdr after that comes the sequence of commands,:!coffee %
the command,<CR>
Enter
If you'd like to be able to use Cmdr to run in both command mode and edit mode, add this to your ~/.vimrc:
inoremap <D-r> <ESC>:!coffee %<CR>
nnoremap <D-r> :!coffee %<CR>
inoremap
will be called in edit modennoremap
will be called in command modeFor anybody looking at this now, vim-coffee-script
now supports the CoffeeRun
command. (I assume it didn't at the time this question was originally asked.)
The
CoffeeRun
command compiles the current file or selected snippet and runs the resulting JavaScript. Output is shown at the bottom of the screen.
CoffeeRun: Run some CoffeeScript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With