Polish mode-line + remove hud (replace with padding); update narf-dark

This commit is contained in:
Henrik Lissner 2016-05-01 01:07:45 -04:00
parent 0dc319cb13
commit 8769c3187b
2 changed files with 32 additions and 27 deletions

View file

@ -211,6 +211,11 @@
(defface mode-line-buffer-file nil "Face for mode-line buffer file path") (defface mode-line-buffer-file nil "Face for mode-line buffer file path")
;; Custom modeline segments ;; Custom modeline segments
(spaceline-define-segment *buffer-size ""
"%I"
:when buffer-file-name
:tight-right t)
(spaceline-define-segment *buffer-path (spaceline-define-segment *buffer-path
(if buffer-file-name (if buffer-file-name
(let* ((project-path (narf/project-root)) (let* ((project-path (narf/project-root))
@ -292,11 +297,10 @@ anzu to be enabled."
(let ((here anzu--current-position) (let ((here anzu--current-position)
(total anzu--total-matched)) (total anzu--total-matched))
(format " %s/%d%s " (format " %s/%d%s "
(anzu--format-here-position here total) here total
total (if anzu--overflow-p "+" ""))) (if anzu--overflow-p "+" "")))
:face (if active 'mode-line-count-face 'mode-line-inactive) :face (if active 'mode-line-count-face 'mode-line-inactive)
:when (and (> anzu--total-matched 0) (evil-ex-hl-active-p 'evil-ex-search)) :when (evil-ex-hl-active-p 'evil-ex-search)
:skip-alternate t
:tight t) :tight t)
(spaceline-define-segment *iedit (spaceline-define-segment *iedit
@ -315,10 +319,8 @@ anzu to be enabled."
length)) length))
:when (bound-and-true-p iedit-mode) :when (bound-and-true-p iedit-mode)
:tight t :tight t
:face (if active 'mode-line-count-face 'mode-line-inactive) :face (if active 'mode-line-count-face 'mode-line-inactive))
:skip-alternate t)
(defface mode-line-substitute-face nil "")
(spaceline-define-segment *evil-substitute (spaceline-define-segment *evil-substitute
"Show number of :s matches in real time." "Show number of :s matches in real time."
(let ((range (if evil-ex-range (let ((range (if evil-ex-range
@ -376,9 +378,8 @@ Supports both Emacs and Evil cursor conventions."
(format "%dL" lines) (format "%dL" lines)
(format "%dC %dL" chars lines))) (format "%dC %dL" chars lines)))
(t (format "%dC" (if evil chars (1- chars))))))) (t (format "%dC" (if evil chars (1- chars)))))))
:when (eq 'visual evil-state) :when (evil-visual-state-p)
:face highlight-face :face highlight-face)
:skip-alternate t)
;; flycheck ;; flycheck
(defun narf--flycheck-count (state) (defun narf--flycheck-count (state)
@ -398,8 +399,8 @@ Supports both Emacs and Evil cursor conventions."
'((t (:foreground "#8DE6F7" :distant-foreground "#21889B"))) '((t (:foreground "#8DE6F7" :distant-foreground "#21889B")))
"Face for flycheck info feedback in the modeline.") "Face for flycheck info feedback in the modeline.")
(defvar narf--flycheck-err-cache nil "") (defvar-local narf--flycheck-err-cache nil "")
(defvar narf--flycheck-cache nil "") (defvar-local narf--flycheck-cache nil "")
(spaceline-define-segment *flycheck (spaceline-define-segment *flycheck
"Persistent and cached flycheck indicators in the mode-line." "Persistent and cached flycheck indicators in the mode-line."
(or (and (or (eq narf--flycheck-err-cache narf--flycheck-cache) (or (and (or (eq narf--flycheck-err-cache narf--flycheck-cache)
@ -417,30 +418,32 @@ Supports both Emacs and Evil cursor conventions."
:when (and (bound-and-true-p flycheck-mode) :when (and (bound-and-true-p flycheck-mode)
(or flycheck-current-errors (or flycheck-current-errors
(eq 'running flycheck-last-status-change))) (eq 'running flycheck-last-status-change)))
:tight t :tight t)
:skip-alternate t)
(spaceline-define-segment *hud (defvar narf--mode-line-padding (pl/percent-xpm powerline-height 100 0 100 0 1 nil nil))
(spaceline-define-segment *pad
"A HUD that shows which part of the buffer is currently visible." "A HUD that shows which part of the buffer is currently visible."
(powerline-hud (if active 'spaceline-highlight-face 'region) line-face 1) narf--mode-line-padding
:tight-right t) :tight-right t)
(defun narf-spaceline-init () (defun narf-spaceline-init ()
(spaceline-install (spaceline-install
;; Left side ;; Left side
'((*macro-recording *anzu *iedit *evil-substitute *flycheck) '(((*macro-recording *anzu *iedit *evil-substitute *flycheck)
:skip-alternate t
:fallback *buffer-size)
(*buffer-path *remote-host) (*buffer-path *remote-host)
*buffer-modified *buffer-modified
*vc *vc
) )
;; Right side ;; Right side
'(*selection-info '((*selection-info :when active)
*buffer-encoding-abbrev *buffer-encoding-abbrev
*major-mode *major-mode
*env-version *env-version
(global :when active) (global :when active)
("%l/%c" *buffer-position) ("%l/%c" *buffer-position)
*hud *pad
))) )))
;; Initialize modeline ;; Initialize modeline

View file

@ -62,7 +62,8 @@
(search-rest-fg black) (search-rest-fg black)
(highlight orange) (highlight orange)
(vertical-bar grey-2) (vertical-bar grey-2)
(current-line "#262829") (current-line "#181818")
;; (current-line "#262829")
(selection "#535556") (selection "#535556")
(builtin orange) (builtin orange)
(comments grey-1) (comments grey-1)
@ -117,9 +118,6 @@
`(warning ((,c (:foreground ,yellow)))) `(warning ((,c (:foreground ,yellow))))
`(success ((,c (:foreground ,green )))) `(success ((,c (:foreground ,green ))))
`(spaceline-flycheck-error ((,c (:underline nil :foreground ,black :background ,red))))
`(spaceline-flycheck-warning ((,c (:underline nil :foreground ,black :background ,yellow))))
`(spaceline-flycheck-info ((,c (:underline nil :foreground ,black :background ,green))))
`(flycheck-error ((,c (:underline (:style wave :color ,red) :background ,grey-2)))) `(flycheck-error ((,c (:underline (:style wave :color ,red) :background ,grey-2))))
`(flycheck-warning ((,c (:underline (:style wave :color ,yellow) :background ,grey-2)))) `(flycheck-warning ((,c (:underline (:style wave :color ,yellow) :background ,grey-2))))
`(flycheck-info ((,c (:underline (:style wave :color ,green) :background ,grey-2)))) `(flycheck-info ((,c (:underline (:style wave :color ,green) :background ,grey-2))))
@ -157,7 +155,7 @@
`(vertical-border ((,c (:foreground ,vertical-bar :background ,vertical-bar)))) `(vertical-border ((,c (:foreground ,vertical-bar :background ,vertical-bar))))
`(linum ((,c (:foreground ,linum-fg :background ,bg :bold nil :height 0.8 :underline nil)))) `(linum ((,c (:foreground ,linum-fg :background ,bg :bold nil :height 0.8))))
`(linum-highlight-face ((,c (:inherit linum :foreground ,linum-hl-fg :background ,current-line)))) `(linum-highlight-face ((,c (:inherit linum :foreground ,linum-hl-fg :background ,current-line))))
`(show-paren-match ((,c (:foreground ,magenta :inverse-video t)))) `(show-paren-match ((,c (:foreground ,magenta :inverse-video t))))
@ -167,13 +165,17 @@
`(mode-line-inactive ((,c (:foreground ,modeline-fg-inactive :background ,modeline-bg-inactive)))) `(mode-line-inactive ((,c (:foreground ,modeline-fg-inactive :background ,modeline-bg-inactive))))
`(mode-line-is-modified ((,c (:foreground ,magenta)))) `(mode-line-is-modified ((,c (:foreground ,magenta))))
`(mode-line-buffer-file ((,c (:foreground ,modeline-fg :background nil)))) `(mode-line-buffer-file ((,c (:foreground ,modeline-fg))))
`(mode-line-count-face ((,c (:foreground ,black :background ,magenta))))
`(spaceline-flycheck-error ((,c (:underline nil :foreground ,black :background ,red))))
`(spaceline-flycheck-warning ((,c (:underline nil :foreground ,black :background ,yellow))))
`(spaceline-flycheck-info ((,c (:underline nil :foreground ,black :background ,green))))
`(spaceline-highlight-face ((,c (:foreground ,black :background ,highlight))))
`(powerline-active1 ((,c (:foreground ,modeline-fg-2 :background ,modeline-bg-2)))) `(powerline-active1 ((,c (:foreground ,modeline-fg-2 :background ,modeline-bg-2))))
`(powerline-active2 ((,c (:foreground ,modeline-fg-3 :background ,modeline-bg-3)))) `(powerline-active2 ((,c (:foreground ,modeline-fg-3 :background ,modeline-bg-3))))
`(powerline-inactive1 ((,c (:foreground ,modeline-fg-inactive :background ,modeline-bg-inactive)))) `(powerline-inactive1 ((,c (:foreground ,modeline-fg-inactive :background ,modeline-bg-inactive))))
`(powerline-inactive2 ((,c (:foreground ,modeline-fg-inactive :background ,modeline-bg-inactive)))) `(powerline-inactive2 ((,c (:foreground ,modeline-fg-inactive :background ,modeline-bg-inactive))))
`(spaceline-highlight-face ((,c (:foreground ,black :background ,highlight))))
`(mode-line-count-face ((,c (:foreground ,black :background ,magenta))))
;; Search ;; Search
`(isearch ((,c (:foreground ,search-fg :background ,search-bg)))) `(isearch ((,c (:foreground ,search-fg :background ,search-bg))))