How to show RVM info into emacs mode-line?

80 Views Asked by At

Hey guys I need to see my ruby version and gemset name in emacs mode-line. Do you know how to do it?

2

There are 2 best solutions below

3
Bozhidar Batsov On

Take a look at rvm.el. I provides many features that make the use of RVM from Emacs more enjoyable.

0
squiter On

I tried but I can't custom strings to mode-line so I customize all of it.

;; modeline
(defun branch-name ()
  (when vc-mode
    (concat "\ue0a0 " (substring vc-mode 5))
    ))

(defun current-ruby ()
  (when vc-mode
    (replace-regexp-in-string "\n$" "" (shell-command-to-string "~/.rvm/bin/rvm-prompt"))
))

(setq-default mode-line-format
      (list
       "[" mode-line-modified "]"
       "  "
       "%b"
       "  |  "
       'mode-name
       "  |  "
       '(:eval (projectile-project-name))
       " "
       '(:eval (branch-name))
       "  |  "
       '(:eval (current-ruby))
       "  |  "
       "%p (%l,%c)"
       ))