[Feature] New indicator for markdown/org preview with grip.

This commit is contained in:
Vincent Zhang 2019-08-16 20:05:39 +08:00
parent a6145d435a
commit 0186ce9de9
3 changed files with 28 additions and 1 deletions

View file

@ -37,6 +37,7 @@ The `doom-modeline` was designed for minimalism, and offers:
- An indicator for buffer position which is compatible with `nyan-mode` - An indicator for buffer position which is compatible with `nyan-mode`
- An indicator for party parrot - An indicator for party parrot
- An indicator for PDF page number with `pdf-tools` - An indicator for PDF page number with `pdf-tools`
- An indicator for markdown/org preview with `grip`
- An indicator for battery status with `fancy-battery` - An indicator for battery status with `fancy-battery`
- Truncated file name, file icon, buffer state and project name in buffer - Truncated file name, file icon, buffer state and project name in buffer
information segment, which is compatible with `projectile` and `project` information segment, which is compatible with `projectile` and `project`

View file

@ -65,6 +65,7 @@
(defvar flymake--backend-state) (defvar flymake--backend-state)
(defvar flymake--mode-line-format) (defvar flymake--mode-line-format)
(defvar flymake-menu) (defvar flymake-menu)
(defvar grip-port)
(defvar helm--mode-line-display-prefarg) (defvar helm--mode-line-display-prefarg)
(defvar iedit-occurrences-overlays) (defvar iedit-occurrences-overlays)
(defvar mc/mode-line) (defvar mc/mode-line)
@ -140,6 +141,7 @@
(declare-function flymake-running-backends 'flymake) (declare-function flymake-running-backends 'flymake)
(declare-function flymake-show-diagnostics-buffer 'flymake) (declare-function flymake-show-diagnostics-buffer 'flymake)
(declare-function flymake-start 'flymake) (declare-function flymake-start 'flymake)
(declare-function grip-mode 'grip-mode)
(declare-function helm-candidate-number-at-point 'helm) (declare-function helm-candidate-number-at-point 'helm)
(declare-function helm-get-candidate-number 'helm) (declare-function helm-get-candidate-number 'helm)
(declare-function iedit-find-current-occurrence-overlay 'iedit-lib) (declare-function iedit-find-current-occurrence-overlay 'iedit-lib)
@ -2291,6 +2293,29 @@ The cdr can also be a function that returns a name to use.")
'doom-modeline-buffer-file 'doom-modeline-buffer-file
'mode-line-inactive))))) 'mode-line-inactive)))))
;;
;; Markdown/org preview
;;
(doom-modeline-def-segment grip
(when (bound-and-true-p grip-mode)
(concat
(doom-modeline-spc)
(propertize
(if (display-graphic-p)
(doom-modeline-icon-material "pageview"
:face (if (doom-modeline--active)
'all-the-icons-lblue
'mode-line-inactive)
:height 1.1
:v-adjust -0.225)
"G")
'help-echo (format "Preview with grip: http://localhost:%d
mouse-1: Exit preview" grip-port)
'mouse-face '(:box 0)
'local-map (make-mode-line-mouse-map 'mouse-1 #'grip-mode))
(doom-modeline-spc))))
(provide 'doom-modeline-segments) (provide 'doom-modeline-segments)
;;; doom-modeline-segments.el ends here ;;; doom-modeline-segments.el ends here

View file

@ -57,6 +57,7 @@
;; - An indicator for buffer position which is compatible with nyan-mode ;; - An indicator for buffer position which is compatible with nyan-mode
;; - An indicator for party parrot ;; - An indicator for party parrot
;; - An indicator for PDF page number with pdf-tools ;; - An indicator for PDF page number with pdf-tools
;; - An indicator for markdown/org preivews with grip
;; - An indicator for battery status with fancy-battery ;; - An indicator for battery status with fancy-battery
;; - Truncated file name, file icon, buffer state and project name in buffer ;; - Truncated file name, file icon, buffer state and project name in buffer
;; information segment, which is compatible with projectile and project ;; information segment, which is compatible with projectile and project
@ -88,7 +89,7 @@
(doom-modeline-def-modeline 'main (doom-modeline-def-modeline 'main
'(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info) '(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info)
'(objed-state misc-info persp-name fancy-battery irc mu4e github debug lsp minor-modes input-method indent-info buffer-encoding major-mode process vcs checker)) '(objed-state misc-info persp-name fancy-battery grip irc mu4e github debug lsp minor-modes input-method indent-info buffer-encoding major-mode process vcs checker))
(doom-modeline-def-modeline 'minimal (doom-modeline-def-modeline 'minimal
'(bar matches buffer-info-simple) '(bar matches buffer-info-simple)