0

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

4

2 回答 2

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)"
       ))
于 2015-04-09T19:46:48.487 回答
0

看看rvm.el。我提供了许多特性,使 Emacs 中的 RVM 的使用更加愉快。

于 2015-04-08T21:46:21.637 回答