I recently switched from rvm to rbenv to solve some annoying problems related to rvm. The switch was really painless and after half an hour I was operating again. Next up was integrating rbenv with Emacs.
If you only want to use the global Ruby you configured with rbenv simply add the following lines to your Emacs configuration:
1 2 3
described by Marc Bowes Using rbenv with Emacs
Back with rvm I wrote an elisp package called rvm.el to make it easy to switch between Ruby versions. I’ve engrained to be able to switch rubies inside Emacs and I wanted to be able to do the same thing with rbenv.
Happily integrating rbenv is very simple and switching the Ruby
version is as easy as setting the
variable. I bundled my configuration to an elisp package and thus
rbenv.el was born.
The library currently supports:
rbenv-use-global: activate your global ruby
rbenv-use: allows you to choose what ruby version you want to activate
rbenv-use-corresponding: searches for
.rbenv-versionand activates the corresponding ruby
Note that rbenv.el always configures the complete Emacs session. There is no way to set the Ruby version on a per buffer basis.
Like most elisp packages you can simply download the source from github, add it to the load-path and require ‘rbenv. As an alternative I submitted the package to Marmalade, MELPA and opened a PR on el-get.
Take rbenv.el for a ride and let me know what you think!