mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 11:43:03 +03:00
feat(emacs): tried spaceline
This commit is contained in:
parent
739e0f69d9
commit
c30062c70f
2 changed files with 258 additions and 28 deletions
123
.emacs.d/init.el
123
.emacs.d/init.el
|
|
@ -73,8 +73,8 @@
|
|||
(load custom-file 'noerror)
|
||||
|
||||
(let ((private-file (expand-file-name "private.el" user-emacs-directory)))
|
||||
(when (file-exists-p private-file)
|
||||
(load-file private-file)))
|
||||
|
||||
(load-file private-file))
|
||||
|
||||
(use-package no-littering
|
||||
:straight t)
|
||||
|
|
@ -710,6 +710,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
|
||||
(use-package company-box
|
||||
:straight t
|
||||
:disabled
|
||||
:if (and (display-graphic-p) (not my/lowpower))
|
||||
:after (company)
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
|
@ -835,11 +836,11 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
(doom-themes-treemacs-config))
|
||||
|
||||
(unless my/is-termux
|
||||
(deftheme my-theme)
|
||||
(deftheme my-theme-1)
|
||||
|
||||
(defun my/update-my-theme (&rest _)
|
||||
(custom-theme-set-faces
|
||||
'my-theme
|
||||
'my-theme-1
|
||||
`(tab-bar-tab ((t (
|
||||
:background ,(doom-color 'bg)
|
||||
:foreground ,(doom-color 'yellow)
|
||||
|
|
@ -856,12 +857,24 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
`(epe-pipeline-time-face ((t (:foreground ,(doom-color 'yellow)))))
|
||||
`(epe-pipeline-user-face ((t (:foreground ,(doom-color 'red)))))
|
||||
`(elfeed-search-tag-face ((t (:foreground ,(doom-color 'yellow)))))
|
||||
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow))))))
|
||||
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))
|
||||
`(spaceline-evil-emacs ((t :background ,(doom-color 'bg)
|
||||
:foreground ,(doom-color 'fg))))
|
||||
`(spaceline-evil-insert ((t :background ,(doom-color 'green)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-motion ((t :background ,(doom-color 'magenta)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-normal ((t :background ,(doom-color 'blue)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-replace ((t :background ,(doom-color 'yellow)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-visual ((t :background ,(doom-color 'grey)
|
||||
:foreground ,(doom-color 'base0)))))
|
||||
(custom-theme-set-variables
|
||||
'my-theme
|
||||
'my-theme-1
|
||||
`(aweshell-invalid-command-color ,(doom-color 'red))
|
||||
`(aweshell-valid-command-color ,(doom-color 'green)))
|
||||
(enable-theme 'my-theme))
|
||||
(enable-theme 'my-theme-1))
|
||||
|
||||
(advice-add 'load-theme :after #'my/update-my-theme)
|
||||
(when (fboundp 'doom-color)
|
||||
|
|
@ -959,6 +972,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
|
||||
(use-package doom-modeline
|
||||
:straight t
|
||||
;; :if (not (display-graphic-p))
|
||||
:init
|
||||
(setq doom-modeline-env-enable-python nil)
|
||||
(setq doom-modeline-env-enable-go nil)
|
||||
|
|
@ -967,6 +981,86 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
(setq doom-modeline-minor-modes nil)
|
||||
(setq doom-modeline-buffer-state-icon nil))
|
||||
|
||||
(use-package spaceline
|
||||
:straight t
|
||||
:disabled
|
||||
:config
|
||||
(defun my/format-perspective-list ()
|
||||
(format "[%s]"
|
||||
(let ((curr (persp-current-name)))
|
||||
(mapconcat
|
||||
(lambda (name)
|
||||
(if (string-equal name curr)
|
||||
(propertize
|
||||
name
|
||||
'face
|
||||
'persp-selected-face)
|
||||
name))
|
||||
(persp-names)
|
||||
"|"))))
|
||||
|
||||
(defvar my/spaceline-persp-list "")
|
||||
|
||||
(defun my/persp-update-advice (&rest _)
|
||||
(setq my/spaceline-persp-list (my/format-perspective-list)))
|
||||
|
||||
(advice-add #'persp-update-modestring :after #'my/persp-update-advice)
|
||||
(add-hook 'buffer-list-update-hook #'my/persp-update-advice)
|
||||
(add-hook 'find-file-hook #'my/persp-update-advice)
|
||||
|
||||
(spaceline-define-segment perspective
|
||||
"Perspective.el"
|
||||
my/spaceline-persp-list)
|
||||
(defvar my/exwm-mode-line-info-no-props "")
|
||||
|
||||
(spaceline-define-segment exwm
|
||||
my/exwm-mode-line-info-no-props)
|
||||
(spaceline-define-segment debug-on-error
|
||||
(when debug-on-error
|
||||
(propertize
|
||||
""
|
||||
'face 'warning
|
||||
'local-map (let ((map (make-sparse-keymap)))
|
||||
(define-key map
|
||||
[mode-line mouse-1]
|
||||
#'toggle-debug-on-error)
|
||||
map))))
|
||||
|
||||
(spaceline-define-segment debug-on-quit
|
||||
(when debug-on-quit
|
||||
(propertize
|
||||
""
|
||||
'face 'error
|
||||
'local-map (let ((map (make-sparse-keymap)))
|
||||
(define-key map
|
||||
[mode-line mouse-1]
|
||||
#'toggle-debug-on-quit)
|
||||
map))))
|
||||
(require 'spaceline-config)
|
||||
|
||||
(spaceline-compile
|
||||
"my"
|
||||
'((evil-state :priority 100 :face (spaceline-highlight-face-evil-state))
|
||||
(buffer-modified :priority 50)
|
||||
(version-control :priority 25 :when active)
|
||||
(buffer-id :priority 90))
|
||||
'(;; (global)
|
||||
(exwm :when active)
|
||||
(perspective :when active)
|
||||
(flycheck-error :when active)
|
||||
(flycheck-warning :when active)
|
||||
(debug-on-error :when active)
|
||||
(debug-on-quit :when active)
|
||||
(major-mode :when active :priority 90)
|
||||
(selection-info :priority 95)
|
||||
(line-column :when active :priority 99)
|
||||
(hud :when active :priority 99)))
|
||||
|
||||
(spaceline-ml-my)
|
||||
|
||||
(setq-default mode-line-format '("%e" (:eval (spaceline-ml-my))))
|
||||
(setq mode-line-format '("%e" (:eval (spaceline-ml-my)))))
|
||||
|
||||
(use-package ligature
|
||||
:straight (:host github :repo "mickeynp/ligature.el")
|
||||
:if (display-graphic-p)
|
||||
|
|
@ -1974,7 +2068,16 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
`(("d" "default" plain "%?"
|
||||
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
||||
:unnarrowed t)))
|
||||
(require 'org-roam-protocol))
|
||||
(require 'org-roam-protocol)
|
||||
(general-define-key
|
||||
:keymaps 'org-roam-mode-map
|
||||
:states '(normal)
|
||||
"TAB" #'magit-section-toggle
|
||||
"q" #'quit-window
|
||||
"k" #'magit-section-backward
|
||||
"j" #'magit-section-forward
|
||||
"gr" #'revert-buffer
|
||||
"RET" #'org-roam-buffer-visit-thing))
|
||||
|
||||
(my-leader-def
|
||||
:infix "or"
|
||||
|
|
@ -3659,14 +3762,14 @@ _r_: Restart frame _uo_: Output _sd_: Down stack frame _bh_: Set
|
|||
|
||||
(defun my/update-my-theme-elfeed (&rest _)
|
||||
(custom-theme-set-faces
|
||||
'my-theme
|
||||
'my-theme-1
|
||||
`(elfeed-videos-entry ((t :foreground ,(doom-color 'red))))
|
||||
`(elfeed-twitter-entry ((t :foreground ,(doom-color 'blue))))
|
||||
`(elfeed-emacs-entry ((t :foreground ,(doom-color 'magenta))))
|
||||
`(elfeed-music-entry ((t :foreground ,(doom-color 'green))))
|
||||
`(elfeed-podcasts-entry ((t :foreground ,(doom-color 'yellow))))
|
||||
`(elfeed-blogs-entry ((t :foreground ,(doom-color 'orange)))))
|
||||
(enable-theme 'my-theme))
|
||||
(enable-theme 'my-theme-1))
|
||||
|
||||
(advice-add 'load-theme :after #'my/update-my-theme-elfeed)
|
||||
(when (fboundp 'doom-color)
|
||||
|
|
|
|||
163
Emacs.org
163
Emacs.org
|
|
@ -6,12 +6,7 @@
|
|||
#+OPTIONS: broken-links:auto h:6 toc:nil
|
||||
|
||||
#+begin_quote
|
||||
One day we won't hate one another, no young boy will march to war and I will clean up my Emacs config. But that day isn't today.
|
||||
#+end_quote
|
||||
|
||||
My [[https://www.gnu.org/software/emacs/][Emacs]] configuration.
|
||||
|
||||
As with other files in the repo, parts prefixed with (OFF) are not used but kept for historic purposes.
|
||||
One day we won't hate one another, no young boy will march to war and I will clean up my Emacs config. But that day isn'.
|
||||
|
||||
#+TOC: headlines 6
|
||||
|
||||
|
|
@ -457,8 +452,8 @@ I have some variables which I don't commit to the repo, e.g. my current location
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
(let ((private-file (expand-file-name "private.el" user-emacs-directory)))
|
||||
(when (file-exists-p private-file)
|
||||
(load-file private-file)))
|
||||
|
||||
(load-file private-file))
|
||||
#+end_src
|
||||
** No littering
|
||||
By default Mmacs and its packages create a lot files in =.emacs.d= and in other places. [[https://github.com/emacscollective/no-littering][no-littering]] is a collective effort to redirect all of that to two folders in =user-emacs-directory=.
|
||||
|
|
@ -1378,10 +1373,11 @@ References:
|
|||
(general-imap "C-SPC" 'company-complete)
|
||||
#+end_src
|
||||
|
||||
A company frontend with nice icons.
|
||||
A company frontend with nice icons. Disabled since the base company got icons support and since company-box has some issues with spaceline.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package company-box
|
||||
:straight t
|
||||
:disabled
|
||||
:if (and (display-graphic-p) (not my/lowpower))
|
||||
:after (company)
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
|
@ -1606,11 +1602,11 @@ A custom theme is necessary because if one calls =custom-set-faces= and =custom-
|
|||
Also, a hook allows me to change doom-theme more or less at will, although I do that only to switch to a light theme once in a blue moon.
|
||||
#+begin_src emacs-lisp
|
||||
(unless my/is-termux
|
||||
(deftheme my-theme)
|
||||
(deftheme my-theme-1)
|
||||
|
||||
(defun my/update-my-theme (&rest _)
|
||||
(custom-theme-set-faces
|
||||
'my-theme
|
||||
'my-theme-1
|
||||
`(tab-bar-tab ((t (
|
||||
:background ,(doom-color 'bg)
|
||||
:foreground ,(doom-color 'yellow)
|
||||
|
|
@ -1627,12 +1623,24 @@ Also, a hook allows me to change doom-theme more or less at will, although I do
|
|||
`(epe-pipeline-time-face ((t (:foreground ,(doom-color 'yellow)))))
|
||||
`(epe-pipeline-user-face ((t (:foreground ,(doom-color 'red)))))
|
||||
`(elfeed-search-tag-face ((t (:foreground ,(doom-color 'yellow)))))
|
||||
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow))))))
|
||||
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))
|
||||
`(spaceline-evil-emacs ((t :background ,(doom-color 'bg)
|
||||
:foreground ,(doom-color 'fg))))
|
||||
`(spaceline-evil-insert ((t :background ,(doom-color 'green)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-motion ((t :background ,(doom-color 'magenta)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-normal ((t :background ,(doom-color 'blue)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-replace ((t :background ,(doom-color 'yellow)
|
||||
:foreground ,(doom-color 'base0))))
|
||||
`(spaceline-evil-visual ((t :background ,(doom-color 'grey)
|
||||
:foreground ,(doom-color 'base0)))))
|
||||
(custom-theme-set-variables
|
||||
'my-theme
|
||||
'my-theme-1
|
||||
`(aweshell-invalid-command-color ,(doom-color 'red))
|
||||
`(aweshell-valid-command-color ,(doom-color 'green)))
|
||||
(enable-theme 'my-theme))
|
||||
(enable-theme 'my-theme-1))
|
||||
|
||||
(advice-add 'load-theme :after #'my/update-my-theme)
|
||||
(when (fboundp 'doom-color)
|
||||
|
|
@ -1786,23 +1794,133 @@ Prepend tab name with the shortened projectile project title
|
|||
|
||||
(setq tab-bar-tab-name-function #'my/tab-bar-name-function)
|
||||
#+end_src
|
||||
** Modeline
|
||||
** Doom Modeline
|
||||
A modeline from Doom Emacs.
|
||||
|
||||
A big advantage of this package is that it just works out of the box and does not require much customization. For now I opted out of it in favour of spaceline because I want to have a more powerline-ish look.
|
||||
|
||||
References:
|
||||
- [[https://github.com/seagle0128/doom-modeline][Doom Modeline]]
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package doom-modeline
|
||||
:straight t
|
||||
;; :if (not (display-graphic-p))
|
||||
:init
|
||||
(setq doom-modeline-env-enable-python nil)
|
||||
(setq doom-modeline-env-enable-go nil)
|
||||
(setq doom-modeline-buffer-encoding 'nondefault)
|
||||
(setq doom-modeline-hud t)
|
||||
:config
|
||||
(doom-modeline-mode 1)
|
||||
(setq doom-modeline-minor-modes nil)
|
||||
(setq doom-modeline-buffer-state-icon nil))
|
||||
#+end_src
|
||||
** OFF (OFF) Spaceline
|
||||
A modeline from Spacemacs. It provides a different look than Doom modeline, but also needs to be tuned more.
|
||||
|
||||
#+begin_src emacs-lisp :noweb yes
|
||||
(use-package spaceline
|
||||
:straight t
|
||||
:disabled
|
||||
:config
|
||||
<<spaceline-conf>>)
|
||||
#+end_src
|
||||
*** Perspectives
|
||||
Definining a bunch of custom powerline segments. First, a list of perspectives.
|
||||
|
||||
#+begin_src emacs-lisp :noweb-ref spaceline-conf :tangle no
|
||||
(defun my/format-perspective-list ()
|
||||
(format "[%s]"
|
||||
(let ((curr (persp-current-name)))
|
||||
(mapconcat
|
||||
(lambda (name)
|
||||
(if (string-equal name curr)
|
||||
(propertize
|
||||
name
|
||||
'face
|
||||
'persp-selected-face)
|
||||
name))
|
||||
(persp-names)
|
||||
"|"))))
|
||||
|
||||
(defvar my/spaceline-persp-list "")
|
||||
|
||||
(defun my/persp-update-advice (&rest _)
|
||||
(setq my/spaceline-persp-list (my/format-perspective-list)))
|
||||
|
||||
(advice-add #'persp-update-modestring :after #'my/persp-update-advice)
|
||||
(add-hook 'buffer-list-update-hook #'my/persp-update-advice)
|
||||
(add-hook 'find-file-hook #'my/persp-update-advice)
|
||||
|
||||
(spaceline-define-segment perspective
|
||||
"Perspective.el"
|
||||
my/spaceline-persp-list)
|
||||
#+end_src
|
||||
*** EXWM workspace
|
||||
Current EXWM workspace. The variable is being set in the EXWM config, the segment just displays it.
|
||||
|
||||
#+begin_src emacs-lisp :noweb-ref spaceline-conf :tangle no
|
||||
(defvar my/exwm-mode-line-info-no-props "")
|
||||
|
||||
(spaceline-define-segment exwm
|
||||
my/exwm-mode-line-info-no-props)
|
||||
#+end_src
|
||||
*** Debug
|
||||
Indicators for =debug-on-error= and =debug-on-quit=.
|
||||
|
||||
#+begin_src emacs-lisp :noweb-ref spaceline-conf :tangle no
|
||||
(spaceline-define-segment debug-on-error
|
||||
(when debug-on-error
|
||||
(propertize
|
||||
""
|
||||
'face 'warning
|
||||
'local-map (let ((map (make-sparse-keymap)))
|
||||
(define-key map
|
||||
[mode-line mouse-1]
|
||||
#'toggle-debug-on-error)
|
||||
map))))
|
||||
|
||||
(spaceline-define-segment debug-on-quit
|
||||
(when debug-on-quit
|
||||
(propertize
|
||||
""
|
||||
'face 'error
|
||||
'local-map (let ((map (make-sparse-keymap)))
|
||||
(define-key map
|
||||
[mode-line mouse-1]
|
||||
#'toggle-debug-on-quit)
|
||||
map))))
|
||||
#+end_src
|
||||
*** My theme
|
||||
And a custom spaceline config with segments I like.
|
||||
|
||||
#+begin_src emacs-lisp :noweb-ref spaceline-conf :tangle no
|
||||
(require 'spaceline-config)
|
||||
|
||||
(spaceline-compile
|
||||
"my"
|
||||
'((evil-state :priority 100 :face (spaceline-highlight-face-evil-state))
|
||||
(buffer-modified :priority 50)
|
||||
(version-control :priority 25 :when active)
|
||||
(buffer-id :priority 90))
|
||||
'(;; (global)
|
||||
(exwm :when active)
|
||||
(perspective :when active)
|
||||
(flycheck-error :when active)
|
||||
(flycheck-warning :when active)
|
||||
(debug-on-error :when active)
|
||||
(debug-on-quit :when active)
|
||||
(major-mode :when active :priority 90)
|
||||
(selection-info :priority 95)
|
||||
(line-column :when active :priority 99)
|
||||
(hud :when active :priority 99)))
|
||||
|
||||
(spaceline-ml-my)
|
||||
|
||||
(setq-default mode-line-format '("%e" (:eval (spaceline-ml-my))))
|
||||
(setq mode-line-format '("%e" (:eval (spaceline-ml-my))))
|
||||
#+end_src
|
||||
** Font stuff
|
||||
*** Ligatures
|
||||
Ligature setup for the JetBrainsMono font.
|
||||
|
|
@ -3104,7 +3222,16 @@ References:
|
|||
`(("d" "default" plain "%?"
|
||||
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
||||
:unnarrowed t)))
|
||||
(require 'org-roam-protocol))
|
||||
(require 'org-roam-protocol)
|
||||
(general-define-key
|
||||
:keymaps 'org-roam-mode-map
|
||||
:states '(normal)
|
||||
"TAB" #'magit-section-toggle
|
||||
"q" #'quit-window
|
||||
"k" #'magit-section-backward
|
||||
"j" #'magit-section-forward
|
||||
"gr" #'revert-buffer
|
||||
"RET" #'org-roam-buffer-visit-thing))
|
||||
|
||||
(my-leader-def
|
||||
:infix "or"
|
||||
|
|
@ -5350,14 +5477,14 @@ Also a function to automatically adjust these colors with the Doom theme.
|
|||
#+begin_src emacs-lisp
|
||||
(defun my/update-my-theme-elfeed (&rest _)
|
||||
(custom-theme-set-faces
|
||||
'my-theme
|
||||
'my-theme-1
|
||||
`(elfeed-videos-entry ((t :foreground ,(doom-color 'red))))
|
||||
`(elfeed-twitter-entry ((t :foreground ,(doom-color 'blue))))
|
||||
`(elfeed-emacs-entry ((t :foreground ,(doom-color 'magenta))))
|
||||
`(elfeed-music-entry ((t :foreground ,(doom-color 'green))))
|
||||
`(elfeed-podcasts-entry ((t :foreground ,(doom-color 'yellow))))
|
||||
`(elfeed-blogs-entry ((t :foreground ,(doom-color 'orange)))))
|
||||
(enable-theme 'my-theme))
|
||||
(enable-theme 'my-theme-1))
|
||||
|
||||
(advice-add 'load-theme :after #'my/update-my-theme-elfeed)
|
||||
(when (fboundp 'doom-color)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue