mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Merge branch 'master' of https://github.com/seagle0128/doom-modeline
This commit is contained in:
commit
e8ca0a2b38
1 changed files with 23 additions and 23 deletions
|
@ -312,16 +312,19 @@ active."
|
||||||
(advice-add #'handle-switch-frame :after #'doom-modeline-set-selected-window)
|
(advice-add #'handle-switch-frame :after #'doom-modeline-set-selected-window)
|
||||||
(advice-add #'select-window :after #'doom-modeline-set-selected-window)
|
(advice-add #'select-window :after #'doom-modeline-set-selected-window)
|
||||||
|
|
||||||
|
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
|
||||||
;; Only support python and ruby for now
|
(defvar-local doom-modeline-env-version nil)
|
||||||
|
(defvar-local doom-modeline-env-command nil)
|
||||||
;; TODO torgeir
|
(add-hook 'focus-in-hook #'doom-modeline-update-env)
|
||||||
(add-hook 'python-mode-hook
|
(add-hook 'find-file-hook #'doom-modeline-update-env)
|
||||||
(lambda ()
|
(defun doom-modeline-update-env ()
|
||||||
(setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2")))
|
"Update environment for mode-line."
|
||||||
(add-hook 'ruby-mode-hook
|
(when doom-modeline-env-command
|
||||||
(lambda ()
|
(let* ((default-directory (doom-modeline-project-root))
|
||||||
(setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2")))
|
(s (shell-command-to-string doom-modeline-env-command)))
|
||||||
|
(setq doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s)
|
||||||
|
(replace-match "" t t s)
|
||||||
|
s)))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Modeline helpers
|
;; Modeline helpers
|
||||||
|
@ -864,19 +867,16 @@ enabled."
|
||||||
(add-hook 'org-src-mode-hook #'doom-modeline-set-special-modeline)
|
(add-hook 'org-src-mode-hook #'doom-modeline-set-special-modeline)
|
||||||
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
||||||
|
|
||||||
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
|
;; Versions, support Python, Ruby and Golang
|
||||||
(defvar-local doom-modeline-env-version nil)
|
(add-hook 'python-mode-hook
|
||||||
(defvar-local doom-modeline-env-command nil)
|
(lambda ()
|
||||||
(add-hook 'focus-in-hook #'doom-modeline-update-env)
|
(setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2")))
|
||||||
(add-hook 'find-file-hook #'doom-modeline-update-env)
|
(add-hook 'ruby-mode-hook
|
||||||
(defun doom-modeline-update-env ()
|
(lambda ()
|
||||||
"Update environment for mode-line."
|
(setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2")))
|
||||||
(when doom-modeline-env-command
|
(add-hook 'go-mode-hook
|
||||||
(let* ((default-directory (doom-modeline-project-root))
|
(lambda ()
|
||||||
(s (shell-command-to-string doom-modeline-env-command)))
|
(setq doom-modeline-env-command "go version 2>&1 | cut -d' ' -f3 | tr -d 'go'")))
|
||||||
(setq doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s)
|
|
||||||
(replace-match "" t t s)
|
|
||||||
s)))))
|
|
||||||
|
|
||||||
(provide 'doom-modeline)
|
(provide 'doom-modeline)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue