(packages-install '( powerline ))
While this might make my mode line a bit too cluttered, I like having the name of the function (or org-mode header) on the line:
(setq which-func-unknown "")
(which-function-mode 1)
Let’s “fix” the output of the function based on my mode line:
(setq which-func-format
`(" "
(:propertize which-func-current local-map
(keymap
(mode-line keymap
(mouse-3 . end-of-defun)
(mouse-2 . narrow-to-defun)
(mouse-1 . beginning-of-defun)))
face which-func
mouse-face mode-line-highlight
help-echo "mouse-1: go to beginning\n\
mouse-2: toggle rest visibility\n\
mouse-3: go to end")
" "))
The PowerLine project can really clean up the mode line, but I’m also able to create my own “theme” in order to remove many of the minor modes that don’t really help.
(require 'powerline)
Need the colors to be a bit more pronounced … and grayer.
(custom-set-faces
'(mode-line-buffer-id ((t (:foreground "#008000" :bold t))))
'(which-func ((t (:foreground "#008000"))))
'(mode-line ((t (:foreground "#008000" :background "#dddddd" :box nil))))
'(mode-line-inactive ((t (:foreground "#008000" :background "#bbbbbb" :box nil)))))
Now, let’s create our own theme:
(defun powerline-simpler-vc-mode (s)
(if s
(replace-regexp-in-string "Git:" "" s)
s))
(defun powerline-simpler-minor-display (s)
(replace-regexp-in-string
(concat " "
(mapconcat 'identity '("Undo-Tree" "GitGutter" "Projectile"
"Abbrev" "ColorIds" "MRev" "ElDoc" "Paredit"
"+1" "+2" "FlyC" "Fly" ;; ":1/0"
"Fill" "AC" "FIC") "\\|")) "" s))
(defun powerline-ha-theme ()
"A powerline theme that removes many minor-modes that don't serve much purpose on the mode-line."
(interactive)
(setq-default mode-line-format
'("%e"
(:eval
(let*
((active
(powerline-selected-window-active))
(mode-line
(if active 'mode-line 'mode-line-inactive))
(face1
(if active 'powerline-active1 'powerline-inactive1))
(face2
(if active 'powerline-active2 'powerline-inactive2))
(separator-left
(intern
(format "powerline-%s-%s" powerline-default-separator
(car powerline-default-separator-dir))))
(separator-right
(intern
(format "powerline-%s-%s" powerline-default-separator
(cdr powerline-default-separator-dir))))
(lhs
(list
(powerline-raw "%*" nil 'l)
;; (powerline-buffer-size nil 'l)
(powerline-buffer-id nil 'l)
(powerline-raw " ")
(funcall separator-left mode-line face1)
(powerline-narrow face1 'l)
(powerline-simpler-vc-mode (powerline-vc face1))))
(rhs
(list
(powerline-raw mode-line-misc-info face1 'r)
(powerline-raw "%4l" face1 'r)
(powerline-raw ":" face1)
(powerline-raw "%3c" face1 'r)
(funcall separator-right face1 mode-line)
(powerline-raw " ")
(powerline-raw "%6p" nil 'r)
(powerline-hud face2 face1)))
(center
(list
(powerline-raw " " face1)
(funcall separator-left face1 face2)
(when
(boundp 'erc-modified-channels-object)
(powerline-raw erc-modified-channels-object face2 'l))
(powerline-major-mode face2 'l)
(powerline-process face2)
(powerline-raw " :" face2)
(powerline-simpler-minor-display (powerline-minor-modes face2 'l))
(powerline-raw " " face2)
(funcall separator-right face2 face1))))
(concat
(powerline-render lhs)
(powerline-fill-center face1
(/
(powerline-width center)
2.0))
(powerline-render center)
(powerline-fill face1
(powerline-width rhs))
(powerline-render rhs)))))))
(powerline-ha-theme)
Make sure that we can simply require
this library.
(provide 'init-mode-line)
Before you can build this on a new system, make sure that you put
the cursor over any of these properties, and hit: C-c C-c