This repository has been archived on 2022-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
emacs/modules/em-modeline.el

102 lines
3.0 KiB
EmacsLisp
Raw Normal View History

2018-07-07 22:34:00 +02:00
;;; em-modeline.el --- Module file for configuring the modeline.
2018-02-11 23:34:08 +01:00
;;
;; Copyright (C) 2018 Wojciech Kozlowski
;;
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
;; Created: 11 Feb 2018
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; This module is used for configuring the modeline.
;;
;;; License: GPLv3
;;; Required packages:
2018-07-07 22:34:00 +02:00
;;; Code:
2018-02-11 23:34:08 +01:00
2018-07-07 22:34:00 +02:00
(defvar emodule/em-modeline-packages
2018-02-11 23:34:08 +01:00
2019-02-10 11:35:35 +01:00
'(anzu
doom-modeline)
2018-07-07 22:34:00 +02:00
)
2018-02-11 23:34:08 +01:00
;;; Configuration:
2018-07-07 22:34:00 +02:00
(defun emodule/em-modeline-init ()
"Initialise the `em-modeline' module."
2018-02-11 23:34:08 +01:00
2018-07-07 20:06:37 +02:00
;; Note that doom-modeline requires all-the-icons which in turn require the
;; user to manually install the fonts with the command `M-x
;; all-the-icons-install-fonts'.
(use-package doom-modeline
:hook
2018-07-08 01:29:39 +02:00
(after-init . doom-modeline-init)
:config
2018-07-08 15:03:10 +02:00
(setq-default doom-modeline-height 23)
2018-02-11 23:34:08 +01:00
2019-02-10 11:35:35 +01:00
;; Set anzu-mode
(use-package anzu
:config
(global-anzu-mode 1))
2018-07-08 15:03:10 +02:00
;; Add perspective to modeline
(doom-modeline-def-segment perspective-name
2018-07-08 15:03:10 +02:00
"Perspectives list and selection. Requires `persp-mode' to be enabled."
(if (bound-and-true-p persp-mode)
(persp-format-name (persp-name (persp-curr)))
""))
(doom-modeline-def-segment workspace-number
"The current workspace name or number. Requires `eyebrowse-mode' to be
enabled."
(if (bound-and-true-p eyebrowse-mode)
(let* ((num (eyebrowse--get 'current-slot))
(tag (when num (nth 2 (assoc num (eyebrowse--get 'window-configs)))))
(str (if (and tag (< 0 (length tag)))
tag
(when num (int-to-string num)))))
(propertize str 'face 'doom-modeline-eyebrowse))
2018-07-08 15:03:10 +02:00
""))
2019-03-05 23:07:14 +01:00
;; Necessary to play nice with Helm
(add-hook 'helm-minibuffer-set-up-hook
(lambda ()
(advice-add #'doom-modeline--active :override (lambda () t))))
(add-hook 'helm-cleanup-hook
(lambda ()
(advice-remove #'doom-modeline--active (lambda () t))))
2018-07-08 15:03:10 +02:00
;; Set the modeline
(setq column-number-mode t)
2018-12-07 21:00:21 +01:00
(setq doom-modeline-python-executable "python3")
2018-09-23 01:09:03 +02:00
(doom-modeline-def-modeline 'main
2018-07-08 15:03:10 +02:00
2018-11-06 02:12:44 +01:00
'(bar
"["
2018-09-23 01:09:03 +02:00
perspective-name
":"
2018-09-23 01:09:03 +02:00
workspace-number
"]"
window-number
2018-09-23 01:09:03 +02:00
matches
buffer-info
remote-host
buffer-position
2018-09-23 01:09:03 +02:00
selection-info)
2018-07-08 15:03:10 +02:00
'(lsp
debug
buffer-encoding
2018-09-23 01:09:03 +02:00
major-mode
vcs
checker))
2018-07-08 15:03:10 +02:00
)
2018-02-11 23:34:08 +01:00
)
2018-07-07 22:34:00 +02:00
(provide 'em-modeline)
;;; em-modeline.el ends here