Refactor modeline
This commit is contained in:
parent
a364cf2695
commit
f134c6f267
1 changed files with 15 additions and 20 deletions
|
@ -202,21 +202,19 @@
|
||||||
|
|
||||||
(spaceline-define-segment narf-buffer-modified
|
(spaceline-define-segment narf-buffer-modified
|
||||||
(concat
|
(concat
|
||||||
(if (and buffer-file-name (buffer-modified-p)) "[+]")
|
(when buffer-file-name
|
||||||
(if buffer-read-only "[RO]")
|
(concat
|
||||||
(if (and buffer-file-name (not (file-exists-p buffer-file-name))) "[!]"))
|
(when (buffer-modified-p) "[+]")
|
||||||
|
(unless (file-exists-p buffer-file-name) "[!]")))
|
||||||
|
(if buffer-read-only "[RO]"))
|
||||||
:face mode-line-is-modified
|
:face mode-line-is-modified
|
||||||
:when (not (string-match-p "^\\s*\\*" (buffer-name)))
|
:when (not (string-prefix-p "*" (buffer-name)))
|
||||||
:tight t)
|
:tight t)
|
||||||
|
|
||||||
(spaceline-define-segment narf-buffer-encoding-abbrev
|
(spaceline-define-segment narf-buffer-encoding-abbrev
|
||||||
"The line ending convention used in the buffer."
|
"The line ending convention used in the buffer."
|
||||||
(let ((buf-coding (symbol-name buffer-file-coding-system)))
|
(symbol-name buffer-file-coding-system)
|
||||||
(if (string-match "\\(dos\\|unix\\|mac\\)" buf-coding)
|
:when (not (string-prefix-p "utf-8" (symbol-name buffer-file-coding-system))))
|
||||||
(match-string 1 buf-coding)
|
|
||||||
buf-coding))
|
|
||||||
:when (and buffer-file-name
|
|
||||||
(not (string-match-p "unix" (symbol-name buffer-file-coding-system)))))
|
|
||||||
|
|
||||||
(spaceline-define-segment narf-buffer-position
|
(spaceline-define-segment narf-buffer-position
|
||||||
"A more vim-like buffer position."
|
"A more vim-like buffer position."
|
||||||
|
@ -260,17 +258,14 @@ to be enabled."
|
||||||
(let ((here anzu--current-position)
|
(let ((here anzu--current-position)
|
||||||
(total anzu--total-matched))
|
(total anzu--total-matched))
|
||||||
(when anzu--state
|
(when anzu--state
|
||||||
(concat
|
(cl-case anzu--state
|
||||||
(propertize
|
(search (format " %s/%d%s "
|
||||||
(cl-case anzu--state
|
(anzu--format-here-position here total)
|
||||||
(search (format " %s/%d%s "
|
total (if anzu--overflow-p "+" "")))
|
||||||
(anzu--format-here-position here total)
|
(replace-query (format " %d replace " total))
|
||||||
total (if anzu--overflow-p "+" "")))
|
(replace (format " %d/%d " here total)))))
|
||||||
(replace-query (format " %d replace " total))
|
|
||||||
(replace (format " %d/%d " here total)))
|
|
||||||
'face highlight-face)
|
|
||||||
" ")))
|
|
||||||
:when (and active (bound-and-true-p anzu--state))
|
:when (and active (bound-and-true-p anzu--state))
|
||||||
|
:face highlight-face
|
||||||
:tight t)
|
:tight t)
|
||||||
|
|
||||||
;; Initialize modeline
|
;; Initialize modeline
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue