mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 11:09:52 +00:00
Enable all-the-icons in terminal.
Use doom-modeline-icon to enable/disable icons.
This commit is contained in:
parent
6d9020c428
commit
5aa211cf04
2 changed files with 32 additions and 24 deletions
12
README.md
12
README.md
|
@ -52,21 +52,25 @@ Recommand to use [doom-themes](https://github.com/hlissner/emacs-doom-themes);
|
||||||
## Customize
|
## Customize
|
||||||
|
|
||||||
``` emacs-lisp
|
``` emacs-lisp
|
||||||
;; How tall the mode-line should be (only respected in GUI Emacs)
|
;; How tall the mode-line should be (only respected in GUI Emacs).
|
||||||
(setq doom-modeline-height 25)
|
(setq doom-modeline-height 25)
|
||||||
|
|
||||||
;; How wide the mode-line bar should be (only respected in GUI Emacs)
|
;; How wide the mode-line bar should be (only respected in GUI Emacs).
|
||||||
(setq doom-modeline-bar-width 3)
|
(setq doom-modeline-bar-width 3)
|
||||||
|
|
||||||
;; Determines the style used by `doom-modeline-buffer-file-name'
|
;; Determines the style used by `doom-modeline-buffer-file-name'.
|
||||||
;; If you are expereicing the laggy issue, especially while editing remote files
|
;; If you are expereicing the laggy issue, especially while editing remote files
|
||||||
;; with tramp, please use `file-name', `truncate-all' or `truncate-upto-root'
|
;; with tramp, please use `file-name', `truncate-all' or `truncate-upto-root'
|
||||||
;; style.
|
;; style.
|
||||||
;; Please refer to https://github.com/bbatsov/projectile/issues/657.
|
;; Please refer to https://github.com/bbatsov/projectile/issues/657.
|
||||||
(setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
|
(setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
|
||||||
|
|
||||||
;; What executable of Python will be used (if nil nothing will be shown)
|
;; What executable of Python will be used (if nil nothing will be showed).
|
||||||
(setq doom-modeline-python-executable "python")
|
(setq doom-modeline-python-executable "python")
|
||||||
|
|
||||||
|
;; Whether show `all-the-icons' or not (if nil nothing will be showed).
|
||||||
|
;; The icons may not be showed correctly on Windows. Disable to make it work.
|
||||||
|
(setq doom-modeline-icon t)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
|
@ -85,7 +85,11 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
|
||||||
file-name => comint.el")
|
file-name => comint.el")
|
||||||
|
|
||||||
(defvar doom-modeline-python-executable "python"
|
(defvar doom-modeline-python-executable "python"
|
||||||
"What executable of Python will be used (if nil nothing will be shown).")
|
"What executable of Python will be used (if nil nothing will be showed).")
|
||||||
|
|
||||||
|
(defvar doom-modeline-icon t
|
||||||
|
"Whether show `all-the-icons' or not (if nil nothing will be showed).
|
||||||
|
The icons may not be showed correctly on Windows. Disable to make it work.")
|
||||||
|
|
||||||
;; externs
|
;; externs
|
||||||
(defvar anzu--current-position)
|
(defvar anzu--current-position)
|
||||||
|
@ -422,19 +426,19 @@ active.")
|
||||||
;; Modeline helpers
|
;; Modeline helpers
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defun doom-modeline-maybe-icon-octicon (&rest args)
|
(defun doom-modeline-icon-octicon (&rest args)
|
||||||
"Display octicon via `ARGS'."
|
"Display octicon via `ARGS'."
|
||||||
(when (display-graphic-p)
|
(when doom-modeline-icon
|
||||||
(apply 'all-the-icons-octicon args)))
|
(apply 'all-the-icons-octicon args)))
|
||||||
|
|
||||||
(defun doom-modeline-maybe-icon-faicon (&rest args)
|
(defun doom-modeline-icon-faicon (&rest args)
|
||||||
"Display font awesome icon via `ARGS'."
|
"Display font awesome icon via `ARGS'."
|
||||||
(when (display-graphic-p)
|
(when doom-modeline-icon
|
||||||
(apply 'all-the-icons-faicon args)))
|
(apply 'all-the-icons-faicon args)))
|
||||||
|
|
||||||
(defun doom-modeline-maybe-icon-material (&rest args)
|
(defun doom-modeline-icon-material (&rest args)
|
||||||
"Display material icon via `ARGS'."
|
"Display material icon via `ARGS'."
|
||||||
(when (display-graphic-p)
|
(when doom-modeline-icon
|
||||||
(apply 'all-the-icons-material args)))
|
(apply 'all-the-icons-material args)))
|
||||||
|
|
||||||
(defun doom-modeline--active ()
|
(defun doom-modeline--active ()
|
||||||
|
@ -574,7 +578,7 @@ Example:
|
||||||
buffer where knowing the current project directory is important."
|
buffer where knowing the current project directory is important."
|
||||||
(let ((face (if (doom-modeline--active) 'doom-modeline-buffer-path)))
|
(let ((face (if (doom-modeline--active) 'doom-modeline-buffer-path)))
|
||||||
(concat (if (display-graphic-p) " ")
|
(concat (if (display-graphic-p) " ")
|
||||||
(doom-modeline-maybe-icon-octicon
|
(doom-modeline-icon-octicon
|
||||||
"file-directory"
|
"file-directory"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05
|
:v-adjust -0.05
|
||||||
|
@ -587,26 +591,26 @@ buffer where knowing the current project directory is important."
|
||||||
"Combined information about the current buffer, including the current working
|
"Combined information about the current buffer, including the current working
|
||||||
directory, the file name, and its state (modified, read-only or non-existent)."
|
directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
(concat (cond (buffer-read-only
|
(concat (cond (buffer-read-only
|
||||||
(concat (doom-modeline-maybe-icon-octicon
|
(concat (doom-modeline-icon-octicon
|
||||||
"lock"
|
"lock"
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))
|
" "))
|
||||||
((buffer-modified-p)
|
((buffer-modified-p)
|
||||||
(concat (doom-modeline-maybe-icon-faicon
|
(concat (doom-modeline-icon-faicon
|
||||||
"floppy-o"
|
"floppy-o"
|
||||||
:face 'doom-modeline-buffer-modified
|
:face 'doom-modeline-buffer-modified
|
||||||
:v-adjust -0.0575)
|
:v-adjust -0.0575)
|
||||||
" "))
|
" "))
|
||||||
((and buffer-file-name
|
((and buffer-file-name
|
||||||
(not (file-exists-p buffer-file-name)))
|
(not (file-exists-p buffer-file-name)))
|
||||||
(concat (doom-modeline-maybe-icon-octicon
|
(concat (doom-modeline-icon-octicon
|
||||||
"circle-slash"
|
"circle-slash"
|
||||||
:face 'doom-modeline-urgent
|
:face 'doom-modeline-urgent
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))
|
" "))
|
||||||
((buffer-narrowed-p)
|
((buffer-narrowed-p)
|
||||||
(concat (doom-modeline-maybe-icon-octicon
|
(concat (doom-modeline-icon-octicon
|
||||||
"fold"
|
"fold"
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
|
@ -686,25 +690,25 @@ mouse-3: Toggle minor modes"
|
||||||
(let ((face 'mode-line-inactive)
|
(let ((face 'mode-line-inactive)
|
||||||
(active (doom-modeline--active))
|
(active (doom-modeline--active))
|
||||||
(all-the-icons-default-adjust -0.1))
|
(all-the-icons-default-adjust -0.1))
|
||||||
(concat (if (display-graphic-p) " ")
|
(concat " "
|
||||||
(cond ((memq state '(edited added))
|
(cond ((memq state '(edited added))
|
||||||
(if active (setq face 'doom-modeline-info))
|
(if active (setq face 'doom-modeline-info))
|
||||||
(doom-modeline-maybe-icon-octicon
|
(doom-modeline-icon-octicon
|
||||||
"git-compare"
|
"git-compare"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05))
|
:v-adjust -0.05))
|
||||||
((eq state 'needs-merge)
|
((eq state 'needs-merge)
|
||||||
(if active (setq face 'doom-modeline-info))
|
(if active (setq face 'doom-modeline-info))
|
||||||
(doom-modeline-maybe-icon-octicon "git-merge" :face face))
|
(doom-modeline-icon-octicon "git-merge" :face face))
|
||||||
((eq state 'needs-update)
|
((eq state 'needs-update)
|
||||||
(if active (setq face 'doom-modeline-warning))
|
(if active (setq face 'doom-modeline-warning))
|
||||||
(doom-modeline-maybe-icon-octicon "arrow-down" :face face))
|
(doom-modeline-icon-octicon "arrow-down" :face face))
|
||||||
((memq state '(removed conflict unregistered))
|
((memq state '(removed conflict unregistered))
|
||||||
(if active (setq face 'doom-modeline-urgent))
|
(if active (setq face 'doom-modeline-urgent))
|
||||||
(doom-modeline-maybe-icon-octicon "alert" :face face))
|
(doom-modeline-icon-octicon "alert" :face face))
|
||||||
(t
|
(t
|
||||||
(if active (setq face 'font-lock-doc-face))
|
(if active (setq face 'font-lock-doc-face))
|
||||||
(doom-modeline-maybe-icon-octicon
|
(doom-modeline-icon-octicon
|
||||||
"git-branch"
|
"git-branch"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05)))
|
:v-adjust -0.05)))
|
||||||
|
@ -738,7 +742,7 @@ Uses `all-the-icons-material' to fetch the icon."
|
||||||
(concat (if vc-mode " " " ")
|
(concat (if vc-mode " " " ")
|
||||||
(when icon
|
(when icon
|
||||||
(concat
|
(concat
|
||||||
(doom-modeline-maybe-icon-material icon :face face :height 1.1 :v-adjust (or voffset -0.2))
|
(doom-modeline-icon-material icon :face face :height 1.1 :v-adjust (or voffset -0.2))
|
||||||
(if text doom-modeline-vspc)))
|
(if text doom-modeline-vspc)))
|
||||||
(if text (propertize text 'face face))
|
(if text (propertize text 'face face))
|
||||||
(if vc-mode " " " ")))
|
(if vc-mode " " " ")))
|
||||||
|
@ -828,7 +832,7 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
"Macro")
|
"Macro")
|
||||||
'face 'doom-modeline-panel)
|
'face 'doom-modeline-panel)
|
||||||
sep
|
sep
|
||||||
(doom-modeline-maybe-icon-octicon "triangle-right"
|
(doom-modeline-icon-octicon "triangle-right"
|
||||||
:face 'doom-modeline-panel
|
:face 'doom-modeline-panel
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
sep))))
|
sep))))
|
||||||
|
|
Loading…
Reference in a new issue