如何将RVM信息显示到emacs模式行?

时间:2015-04-08 21:10:05

标签: ruby emacs rvm modeline

嘿伙计们,我需要在emacs模式行中看到我的ruby版本和gemset名称。你知道怎么做吗?

2 个答案:

答案 0 :(得分:0)

看看rvm.el。我提供了许多功能,使得使用Emacs的RVM更加愉快。

答案 1 :(得分:0)

我试过但我不能自定义mode-line字符串,所以我自定义了所有字符串。

;; 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)"
       ))