Reorganize spaceline config

This commit is contained in:
Henrik Lissner 2015-12-12 01:25:14 -05:00
parent 1ac7f5504b
commit caa1f21901

View file

@ -258,6 +258,11 @@
:skip-alternate t :skip-alternate t
:tight-right t) :tight-right t)
(spaceline-define-segment *remote-host
"Hostname for remote buffers."
(concat "@" (file-remote-p default-directory 'host))
:when (file-remote-p default-directory 'host))
(spaceline-define-segment *buffer-modified (spaceline-define-segment *buffer-modified
(concat (concat
(when buffer-file-name (when buffer-file-name
@ -270,12 +275,6 @@
:skip-alternate t :skip-alternate t
:tight t) :tight t)
(spaceline-define-segment *buffer-encoding-abbrev
"The line ending convention used in the buffer."
(symbol-name buffer-file-coding-system)
:when (not (string-match-p "\\(utf-8\\|undecided\\)"
(symbol-name buffer-file-coding-system))))
(spaceline-define-segment *buffer-position (spaceline-define-segment *buffer-position
"A more vim-like buffer position." "A more vim-like buffer position."
(let ((start (window-start)) (let ((start (window-start))
@ -312,19 +311,16 @@
:tight-right t) :tight-right t)
(spaceline-define-segment *env-version (spaceline-define-segment *env-version
"A HUD that shows which part of the buffer is currently visible." "Shows the environment version of a mode (e.g. pyenv for python or rbenv for ruby).
See `define-env-command!' to define one for a mode."
narf--env-version narf--env-version
:when narf--env-version :when narf--env-version
:face other-face :face other-face
:skip-alternate t :skip-alternate t
:tight-right t) :tight-right t)
(spaceline-define-segment *hud
"A HUD that shows which part of the buffer is currently visible."
(powerline-hud highlight-face other-face 1)
:face other-face
:tight-right t)
(progn ;; search indicators
(defface mode-line-count-face nil "") (defface mode-line-count-face nil "")
(make-variable-buffer-local 'anzu--state) (make-variable-buffer-local 'anzu--state)
(spaceline-define-segment *anzu (spaceline-define-segment *anzu
@ -374,7 +370,7 @@ iedit."
" ... ")) " ... "))
:when (and (evil-ex-p) (evil-ex-hl-active-p 'evil-ex-substitute)) :when (and (evil-ex-p) (evil-ex-hl-active-p 'evil-ex-substitute))
:face (if active 'mode-line-count-face 'mode-line-inactive) :face (if active 'mode-line-count-face 'mode-line-inactive)
:skip-alternate t) :skip-alternate t))
(spaceline-define-segment *macro-recording (spaceline-define-segment *macro-recording
"Show when recording macro" "Show when recording macro"
@ -383,6 +379,12 @@ iedit."
:face highlight-face :face highlight-face
:skip-alternate t) :skip-alternate t)
(spaceline-define-segment *buffer-encoding-abbrev
"The line ending convention used in the buffer."
(symbol-name buffer-file-coding-system)
:when (not (string-match-p "\\(utf-8\\|undecided\\)"
(symbol-name buffer-file-coding-system))))
(spaceline-define-segment *major-mode (spaceline-define-segment *major-mode
(powerline-raw (powerline-raw
(concat (concat
@ -395,11 +397,6 @@ iedit."
:tight-right t :tight-right t
:skip-alternate t) :skip-alternate t)
(spaceline-define-segment *remote-host
"Hostname for remote buffers."
(concat "@" (file-remote-p default-directory 'host))
:when (file-remote-p default-directory 'host))
(defun narf--col-at-pos (pos) (defun narf--col-at-pos (pos)
(save-excursion (goto-char pos) (current-column))) (save-excursion (goto-char pos) (current-column)))
(spaceline-define-segment *selection-info (spaceline-define-segment *selection-info
@ -426,6 +423,7 @@ Supports both Emacs and Evil cursor conventions."
:face highlight-face :face highlight-face
:skip-alternate t) :skip-alternate t)
(progn ;; flycheck
(defun narf--flycheck-count (state) (defun narf--flycheck-count (state)
"Return flycheck information for the given error type STATE." "Return flycheck information for the given error type STATE."
(let* ((counts (flycheck-count-errors flycheck-current-errors)) (let* ((counts (flycheck-count-errors flycheck-current-errors))
@ -463,7 +461,14 @@ 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-left t)) :tight-left t
:skip-alternate t))
(spaceline-define-segment *hud
"A HUD that shows which part of the buffer is currently visible."
(powerline-hud highlight-face other-face 1)
:face other-face
:tight-right t))
;; Initialize modeline ;; Initialize modeline
(spaceline-install (spaceline-install