Redo modeline (using spaceline)
This commit is contained in:
parent
86596df667
commit
0489e3a4a5
2 changed files with 24 additions and 89 deletions
1
Cask
1
Cask
|
@ -19,6 +19,7 @@
|
||||||
;; UI --- core/core-ui.el
|
;; UI --- core/core-ui.el
|
||||||
(depends-on "nlinum")
|
(depends-on "nlinum")
|
||||||
(depends-on "smart-mode-line")
|
(depends-on "smart-mode-line")
|
||||||
|
(depends-on "spaceline" :git "https://github.com/TheBB/spaceline")
|
||||||
|
|
||||||
;; Evil --- core/core-evil.el
|
;; Evil --- core/core-evil.el
|
||||||
(depends-on "evil")
|
(depends-on "evil")
|
||||||
|
|
112
core/core-ui.el
112
core/core-ui.el
|
@ -89,96 +89,30 @@
|
||||||
(add-hook! nlinum-mode
|
(add-hook! nlinum-mode
|
||||||
(setq nlinum--width (length (number-to-string (count-lines (point-min) (point-max)))))))
|
(setq nlinum--width (length (number-to-string (count-lines (point-min) (point-max)))))))
|
||||||
|
|
||||||
(use-package smart-mode-line ; customized modeline
|
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
:init (setq-default
|
|
||||||
sml/no-confirm-load-theme t
|
|
||||||
sml/mode-width 'full
|
|
||||||
sml/extra-filler -6
|
|
||||||
sml/show-remote nil
|
|
||||||
sml/encoding-format nil
|
|
||||||
sml/modified-char "*"
|
|
||||||
sml/numbers-separator "/"
|
|
||||||
sml/line-number-format "%l"
|
|
||||||
sml/col-number-format "%c"
|
|
||||||
sml/position-percentage-format "%P"
|
|
||||||
sml/pre-modes-separator " ["
|
|
||||||
sml/pre-minor-modes-separator " "
|
|
||||||
sml/pos-minor-modes-separator "] "
|
|
||||||
sml/replacer-regexp-list '(("^~/.emacs.d/" "EMACS.D:")
|
|
||||||
("^~/Dropbox/Projects/" "PROJECTS:")
|
|
||||||
("^~/Dropbox/notes/" "NOTES:")
|
|
||||||
("^/usr/local/Cellar/" "HOMEBREW:")))
|
|
||||||
:config
|
|
||||||
;; Hack modeline to be more vim-like, and right-aligned
|
|
||||||
(defun sml/generate-minor-modes ()
|
|
||||||
(if sml/simplified
|
|
||||||
""
|
|
||||||
(let* ((nameList (rm--mode-list-as-string-list))
|
|
||||||
(last nil)
|
|
||||||
(concatList (mapconcat (lambda (mode)
|
|
||||||
(setq mode (s-trim mode))
|
|
||||||
(if (> (length mode) 1)
|
|
||||||
(prog1 (concat (if last " ") mode " ")
|
|
||||||
(setq last nil))
|
|
||||||
(prog1 mode
|
|
||||||
(setq last t))))
|
|
||||||
nameList ""))
|
|
||||||
(size (sml/fill-width-available))
|
|
||||||
(finalNameList concatList)
|
|
||||||
needs-removing filling)
|
|
||||||
(when (and sml/shorten-modes (> (length finalNameList) size))
|
|
||||||
(setq needs-removing
|
|
||||||
(1+ (sml/count-occurrences-starting-at
|
|
||||||
" " finalNameList
|
|
||||||
(- size (string-width sml/full-mode-string))))))
|
|
||||||
(when needs-removing
|
|
||||||
(setcdr (last nameList (1+ needs-removing))
|
|
||||||
(list t sml/propertized-full-mode-string)))
|
|
||||||
(unless sml/shorten-modes
|
|
||||||
(add-to-list 'nameList sml/propertized-shorten-mode-string t))
|
|
||||||
(setq filling (- size (+ (length (format-mode-line concatList)) (length mode-name) (length vc-mode))))
|
|
||||||
(setq filling (make-string (max 0 filling) sml/fill-char))
|
|
||||||
(list (propertize filling 'face 'sml/modes)
|
|
||||||
(propertize (or vc-mode "") 'face 'sml/vc)
|
|
||||||
(propertize sml/pre-modes-separator 'face 'font-lock-comment-delimiter-face)
|
|
||||||
(propertize mode-name)
|
|
||||||
'sml/pre-minor-modes-separator
|
|
||||||
concatList
|
|
||||||
(propertize sml/pos-minor-modes-separator 'face
|
|
||||||
'font-lock-comment-delimiter-face)))))
|
|
||||||
|
|
||||||
;; Hide evil state indicator
|
(setq-default powerline-default-separator nil)
|
||||||
(after! evil (setq evil-mode-line-format nil))
|
(require 'spaceline-segments)
|
||||||
;; Add small gap for anzu display
|
(spaceline-install
|
||||||
(after! anzu
|
;; Left side
|
||||||
(defun narf--anzu-update-mode-line (here total)
|
'((buffer-size)
|
||||||
(concat (anzu--update-mode-line-default here total) " "))
|
(buffer-id remote-host buffer-modified)
|
||||||
(setq anzu-mode-line-update-function 'narf--anzu-update-mode-line))
|
((flycheck-error flycheck-warning flycheck-info)
|
||||||
(sml/setup)
|
:when active)
|
||||||
(sml/apply-theme 'respectful)
|
(version-control :when active))
|
||||||
;; Remove extra spaces in format lists
|
;; Right side
|
||||||
(pop mode-line-modes)
|
`((battery :when active)
|
||||||
(nbutlast mode-line-modes)
|
selection-info
|
||||||
;; Remove spacing in mode-line position so we can put it elsewhere
|
major-mode
|
||||||
(setq mode-line-position
|
(((minor-modes :separator spaceline-minor-modes-separator)
|
||||||
'(":" (sml/position-percentage-format
|
process)
|
||||||
(-3 (:propertize (:eval sml/position-percentage-format) face sml/position-percentage)))))
|
:when active)
|
||||||
|
(buffer-encoding-abbrev
|
||||||
;; Rearrange and cleanup
|
point-position
|
||||||
(setq-default mode-line-format
|
line-column)
|
||||||
'("%e"
|
(global :when active)
|
||||||
mode-line-mule-info
|
buffer-position
|
||||||
mode-line-client
|
hud))
|
||||||
;; mode-line-remote
|
|
||||||
mode-line-frame-identification
|
|
||||||
mode-line-buffer-identification
|
|
||||||
mode-line-modified
|
|
||||||
mode-line-misc-info
|
|
||||||
mode-line-modes
|
|
||||||
mode-line-front-space
|
|
||||||
mode-line-end-spaces
|
|
||||||
" "
|
|
||||||
mode-line-position)))
|
|
||||||
|
|
||||||
(provide 'core-ui)
|
(provide 'core-ui)
|
||||||
;;; core-ui.el ends here
|
;;; core-ui.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue