Aligning and adjusting mode-line for better-mode-line
This commit is contained in:
@@ -1332,46 +1332,50 @@ the mode line with space strings to achieve this.
|
|||||||
:demand t
|
:demand t
|
||||||
:init
|
:init
|
||||||
(defun +mode-line/evil-state ()
|
(defun +mode-line/evil-state ()
|
||||||
"Returns either the empty string if no evil-state is defined or
|
"Returns either \"E\" if no evil-state is defined or the first character
|
||||||
the first character of the evil state capitalised"
|
of the evil state capitalised"
|
||||||
(with-eval-after-load "evil"
|
(with-eval-after-load "evil"
|
||||||
(if (bound-and-true-p evil-state)
|
(if (bound-and-true-p evil-state)
|
||||||
(-->
|
(-->
|
||||||
(format "%s" evil-state)
|
(format "%s" evil-state)
|
||||||
(substring it 0 1)
|
(substring it 0 1)
|
||||||
(upcase it))
|
(upcase it))
|
||||||
"")))
|
"E")))
|
||||||
|
|
||||||
(setq better-mode-line/left-segment
|
(setq better-mode-line/left-segment
|
||||||
'(" " ;; Left padding
|
'(" " ;; Left padding
|
||||||
(:eval
|
(:eval
|
||||||
(when (mode-line-window-selected-p)
|
(when (mode-line-window-selected-p)
|
||||||
'("%l:%c" ;; Line and column count
|
'("%l:%c" ;; Line and column count
|
||||||
" "
|
" "
|
||||||
"%p" ;; Percentage into buffer
|
"%p" ;; Percentage into buffer
|
||||||
("[" ;; Evil state
|
"[" ;; Evil state
|
||||||
(:eval
|
(:eval
|
||||||
(+mode-line/evil-state))
|
(+mode-line/evil-state))
|
||||||
"]")))))
|
"]"))))
|
||||||
better-mode-line/centre-segment
|
better-mode-line/centre-segment
|
||||||
'("%+" ;; Buffer state (changed or not)
|
'("%+" ;; Buffer state (changed or not)
|
||||||
"%b" ;; Buffer name
|
"%b" ;; Buffer name
|
||||||
"(" ;; Major mode
|
"(" ;; Major mode
|
||||||
(:eval (format "%s" major-mode))
|
(:eval (format "%s" major-mode))
|
||||||
")")
|
")")
|
||||||
better-mode-line/right-segment
|
better-mode-line/right-segment
|
||||||
'((:eval
|
'((:eval
|
||||||
(when (mode-line-window-selected-p)
|
(when (mode-line-window-selected-p)
|
||||||
(if (project-current) ;; Name of current project (if any)
|
(format "%s %s"
|
||||||
(format "%s %s"
|
(if (project-current) ;; Name of current project (if any)
|
||||||
(project-name (project-current))
|
(project-name
|
||||||
vc-mode ;; Git branch
|
(project-current))
|
||||||
))))
|
"")
|
||||||
mode-line-misc-info ;; Any other information
|
(if vc-mode ;; Project and Git branch
|
||||||
(:eval ;; Compilation mode errors
|
vc-mode
|
||||||
|
""))
|
||||||
|
))
|
||||||
|
mode-line-misc-info ;; Any other information
|
||||||
|
(:eval ;; Compilation mode errors
|
||||||
(if (eq major-mode 'compilation-mode)
|
(if (eq major-mode 'compilation-mode)
|
||||||
compilation-mode-line-errors))
|
compilation-mode-line-errors))
|
||||||
" " ;; Right padding
|
" " ;; Right padding
|
||||||
))
|
))
|
||||||
:config
|
:config
|
||||||
(better-mode-line/setup-mode-line))
|
(better-mode-line/setup-mode-line))
|
||||||
|
|||||||
Reference in New Issue
Block a user