These plugins just give you some keywords about the language in question, but cannot really give you information about the object you are currently dealing with because they never evluate the code that created it.
Usually when trying to figure things out, run some code in the repl and now it can tell you all kinds of information about objects that were created up to that point. This also includes all exports of modules – which is very useful.
Unfortunately up until now it was a multi step process to source my code in the repl in order to play with it.
I read this post, which explains, how to set up a screen in some unix terminal and then send some text over the created socket. The author also implemented a Vim plugin called slime.vim. I forked it and added some CoffeeScript specific feature which I will explain.
Finally we can send code snippets from Vim directly to the repl without any cut and pasting overhead.
It is actually quite simple to set these things up.
- Install slime.vim into your vim plugins folder
- Open a terminal window and start a named screen e.g. “screen -S coffee”
- Start a repl inside that screen e.g. coffee for a CoffeeScript repl
- Open vim, select some code snippet in visual mode and press Ctrl-c twice
- At the prompt give the screen name e.g. coffee and accept the given window name
- The selected code should have been sent to the repl and you can now inspect the created objects
Unfortunately the coffee repl is not quite as nice as the node repl (especially when it comes to inspect functions and properties of an object), which is why I extended the plugin a bit.
I have yet to figure out how to send a <Tab> signal over in order to trigger completion from inside Vim, so anyone with an idea, please comment!