Polish new mode-line
This commit is contained in:
parent
ba28a7d6fd
commit
16c5280c36
2 changed files with 83 additions and 41 deletions
|
@ -91,28 +91,80 @@
|
||||||
|
|
||||||
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(setq-default powerline-default-separator nil)
|
(use-package spaceline-segments
|
||||||
(require 'spaceline-segments)
|
:init
|
||||||
(spaceline-install
|
(setq-default
|
||||||
;; Left side
|
powerline-default-separator 'wave
|
||||||
'((buffer-size)
|
powerline-height 18)
|
||||||
(buffer-id remote-host buffer-modified)
|
:config
|
||||||
((flycheck-error flycheck-warning flycheck-info)
|
(require 'spaceline-segments)
|
||||||
:when active)
|
|
||||||
(version-control :when active))
|
;; (defface powerline-border '((t (:background "#05051e"))) "")
|
||||||
;; Right side
|
|
||||||
`((battery :when active)
|
(spaceline-define-segment narf-buffer-path
|
||||||
selection-info
|
"Name of buffer."
|
||||||
major-mode
|
(concat (let ((buffer-path (buffer-file-name)))
|
||||||
(((minor-modes :separator spaceline-minor-modes-separator)
|
(if (and buffer-path (file-exists-p buffer-path))
|
||||||
process)
|
(progn
|
||||||
:when active)
|
(setq buffer-path (abbreviate-file-name buffer-path))
|
||||||
(buffer-encoding-abbrev
|
(let ((path (file-relative-name buffer-path (file-name-directory (narf/project-root))))
|
||||||
point-position
|
(max-length (/ (window-width) 2)))
|
||||||
line-column)
|
(if (> (length path) max-length)
|
||||||
(global :when active)
|
(concat "…" (replace-regexp-in-string
|
||||||
buffer-position
|
"^.*?/" "/"
|
||||||
hud))
|
(let ((l (length path))) (substring path (- l max-length) l))))
|
||||||
|
path)))
|
||||||
|
(powerline-buffer-id)))
|
||||||
|
(if (buffer-modified-p) (propertize "*" 'font-lock-face '(:inherit powerline-active1 :foreground "orange")))
|
||||||
|
" ")
|
||||||
|
:tight-right t)
|
||||||
|
|
||||||
|
(spaceline-define-segment narf-buffer-modified
|
||||||
|
"Buffer modified marker."
|
||||||
|
(if (buffer-modified-p) "*")
|
||||||
|
:face highlight-face
|
||||||
|
:tight t)
|
||||||
|
|
||||||
|
(spaceline-define-segment narf-buffer-encoding-abbrev
|
||||||
|
"The line ending convention used in the buffer."
|
||||||
|
(let ((buf-coding (format "%s" buffer-file-coding-system)))
|
||||||
|
(if (string-match "\\(dos\\|unix\\|mac\\)" buf-coding)
|
||||||
|
(match-string 1 buf-coding)
|
||||||
|
buf-coding))
|
||||||
|
:when (not (string-match "unix" (symbol-name buffer-file-coding-system))))
|
||||||
|
|
||||||
|
(spaceline-define-segment narf-line-column
|
||||||
|
"The current line and column numbers."
|
||||||
|
"%l/%c")
|
||||||
|
|
||||||
|
(spaceline-define-segment narf-buffer-position
|
||||||
|
"A more vim-like buffer position."
|
||||||
|
(let ((perc (/ (window-end) 0.01 (point-max))))
|
||||||
|
(cond ((eq (window-start) 1) ":Top")
|
||||||
|
((>= perc 100) ":Bot")
|
||||||
|
(t (format ":%d%%%%" perc)))))
|
||||||
|
|
||||||
|
(spaceline-define-segment narf-vc
|
||||||
|
"Version control info"
|
||||||
|
(replace-regexp-in-string (regexp-quote (symbol-name (vc-deduce-backend))) "" (s-trim (powerline-vc)) t t)
|
||||||
|
:when (powerline-vc))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(spaceline-install
|
||||||
|
;; Left side
|
||||||
|
'(((narf-buffer-path :face other-face) remote-host)
|
||||||
|
((flycheck-error flycheck-warning flycheck-info)
|
||||||
|
:when active)
|
||||||
|
(narf-vc :face other-face :when active))
|
||||||
|
;; Right side
|
||||||
|
'((battery :when active)
|
||||||
|
selection-info
|
||||||
|
narf-buffer-encoding-abbrev
|
||||||
|
(major-mode (minor-modes process :when active))
|
||||||
|
(global :when active)
|
||||||
|
(narf-line-column narf-buffer-position :face powerline-border)
|
||||||
|
hud)))
|
||||||
|
|
||||||
(provide 'core-ui)
|
(provide 'core-ui)
|
||||||
;;; core-ui.el ends here
|
;;; core-ui.el ends here
|
||||||
|
|
|
@ -35,7 +35,9 @@
|
||||||
|
|
||||||
(git-modified "#55616A")
|
(git-modified "#55616A")
|
||||||
(git-added "#436b3b")
|
(git-added "#436b3b")
|
||||||
(git-deleted "#714243"))
|
(git-deleted "#714243")
|
||||||
|
|
||||||
|
(dark-bg "#05051e"))
|
||||||
|
|
||||||
(custom-theme-set-faces
|
(custom-theme-set-faces
|
||||||
'narf-dark
|
'narf-dark
|
||||||
|
@ -50,25 +52,13 @@
|
||||||
|
|
||||||
`(vertical-border ((t (:foreground "#000000") )))
|
`(vertical-border ((t (:foreground "#000000") )))
|
||||||
|
|
||||||
`(mode-line ((t (:foreground ,white
|
`(mode-line ((t (:foreground ,white :background ,gutter-light))))
|
||||||
:background ,gutter-light
|
`(mode-line-inactive ((t (:foreground ,gutter-fg :background ,gutters-active))))
|
||||||
:box (:line-width 3 :color ,gutter-light)
|
|
||||||
))))
|
|
||||||
|
|
||||||
`(mode-line-inactive ((t (:foreground ,gutter-fg
|
|
||||||
:background ,gutters-active
|
|
||||||
:box (:line-width 3 :color ,gutters-active)
|
|
||||||
))))
|
|
||||||
|
|
||||||
`(mode-line-modified-face ((t (:foreground ,builtin))))
|
`(mode-line-modified-face ((t (:foreground ,builtin))))
|
||||||
|
`(powerline-active1 ((t (:background "#343A4D"))))
|
||||||
`(sml/folder ((t nil)))
|
`(powerline-active2 ((t (:background "#3B435C"))))
|
||||||
`(sml/modified ((t (:foreground ,highlight))))
|
`(powerline-inactive2 ((t (:background ,gutters-active))))
|
||||||
|
`(powerline-inactive2 ((t (:background ,gutters-active))))
|
||||||
`(flyspell-incorrect ((t (:underline "#ff5555" :inherit unspecified))))
|
|
||||||
|
|
||||||
`(helm-source-header ((t (:background ,gutters-active :foreground ,strings :weight bold :height 1.0))))
|
|
||||||
`(helm-selection ((t (:background ,selection))))
|
|
||||||
|
|
||||||
;; Font lock faces
|
;; Font lock faces
|
||||||
`(linum-highlight-face ((t (:foreground ,text :background ,line-hl :inherit linum))))
|
`(linum-highlight-face ((t (:foreground ,text :background ,line-hl :inherit linum))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue