2 minutes reading time
There are two problems with keeping a "daemon" compiling coffeescript and those are error handling and always having to initialize that daemon. However, there is a simpler way.
Keeping some kind of long running process just to compile Coffeescript running doesn't really seem like the right solution. Since VIM has great support for modding and making your custom scripts and commands in .vimrc, I decided to find a solution for autocompiling on save instead:
autocmd BufWritePost,FileWritePost *.coffee :silent !coffee -c <afile>
Pretty simple, right? Add parameters according to the Coffeescript documentation to customize the compilation. For example, I don't want to wrap all my separate files with Coffeescripts own wrapper, so I'll add --no-wrap:
autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --no-wrap -c <afile>
Tada! The simple way to compile Coffeescript on save in VIM!Tweet