Use rbenv to manage your Ruby versions within GNU Emacs.
Native:
Clone this repo.
Add into init.el
:
(add-to-list 'load-path (expand-file-name "/path/to/rbenv.el/")) (require 'rbenv) (global-rbenv-mode)
package.el
:
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) (unless package-archive-contents (package-refresh-contents)) (unless (package-installed-p 'rbenv) (package-install 'rbenv)) (require 'rbenv) (global-rbenv-mode)
use-package
:
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) (unless package-archive-contents (package-refresh-contents)) (use-package rbenv :ensure t :config (global-rbenv-mode))
global-rbenv-mode
— activate / deactivate rbenv.el
(The current Ruby version is shown in the modeline).rbenv-use-global
— activate your global Ruby interpreter.rbenv-use
— allows you to choose what Ruby version you want to use.rbenv-use-corresponding
— searches for .ruby-version
and activates the corresponding Ruby interpreter.By default rbenv.el
assumes that you installed rbenv
into ~/.rbenv
. If you use a different installation location you can customize rbenv-installation-dir
variable to search in the right place:
(customize-set-variable 'rbenv-installation-dir "/usr/local/rbenv")
IMPORTANT: Currently you need to set this variable before you load rbenv.el
:
(use-package rbenv :ensure t :init (customize-set-variable 'rbenv-installation-dir "/usr/local/rbenv") :config (global-rbenv-mode))
rbenv.el
will show you the active Ruby in the modeline. If you don't like this feature you can disable it:
(customize-set-variable 'rbenv-show-active-ruby-in-modeline nil)
The default modeline representation is the Ruby version (colored red) in square brackets. You can change the format by customizing the variable rbenv-modeline-function
:
;; this will remove the colors (customize-set-variable 'rbenv-modeline-function 'rbenv--modeline-plain)
You can also define your own function to format the Ruby version as you like.
If you want to read more about rbenv.el
check out the following links:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4