Less alt+tab with SublimeText
May 09, 2013
Back in April, I jokingly lamented not having the ability to run a console from directly within SublimeText — apparently I did not do quite enough searching. There is a plug-in called SublimeREPL that lets you run ruby, node and a whole slew of other environments from within SublimeText.
To install SublimeREPL:
- Fire up the Command Palette (ctrl+shift+p) and type “Package Control: Install Package”
- Search for and install SublimeREPL
- Restart SublimeText
If you are using rbenv, (I assume something similar applies to rvm as well) you will need to edit your SublimeREPL settings (Preferences -> Package Settings -> SublimeREPL -> Settings - User) so your rbenv ruby is used.
{
"default_extend_env": { "PATH": "{HOME}/.rbenv/shims:{PATH}" }
}
Finally, SublimeREPL uses pry to power the ruby REPL. If you don’t have the pry gem installed, you will need to install it prior to running ruby console.
Now that everything is setup you can launch a REPL and test code before you add it to your project, use rake thru shell, etc. One note, I would be careful about running servers — I was messing around with one of my favorite new frameworks and realized I could not shut down the server (this occurs with servers and other long running operations). That being said, SublimeREPL is definitely a plug-in I would recommend.
Hi 👋 I'm Ryan Lanciaux. I run Spaceship Studio, LLC. a consultancy specializing in fast and dynamic web and native mobile applications.
I live in Ann Arbor with my wonderful family! In my freetime, I create electronic music.