Created
November 3, 2012 20:22
-
-
Save krtx/4008601 to your computer and use it in GitHub Desktop.
emacs mode-line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; red | |
;; (defconst color1 "#FF6699") | |
;; (defconst color3 "#CDC0B0") | |
;; (defconst color2 "#FF0066") | |
;; (defconst color4 "#CDC0B0") | |
;;; green | |
;; (defconst color1 "#66FF99") | |
;; (defconst color3 "#E1FFCC") ;; active mode-line | |
;; (defconst color2 "#00FF66") | |
;; (defconst color4 "#90BD98") ;; inactive mode-line | |
(defconst color1 "#FF9966") | |
(defconst color3 "#FFCCE1") ;; active mode-line | |
(defconst color2 "#FF6600") | |
(defconst color4 "#BD9890") ;; inactive mode-line | |
(defconst color-cv "grey80") | |
(defconst color-read-only "#fff") | |
(defconst color-modified "#fff") | |
(defconst color-text "#fff") | |
(defconst color-text-inactive "#ccc") | |
(setq-default | |
mode-line-format | |
'("%e" | |
(:eval | |
(cond (buffer-read-only | |
(propertize "%" 'face 'mode-line-read-only-face)) | |
((buffer-modified-p) | |
(propertize "*" 'face 'mode-line-modified-face)) | |
(t | |
(propertize " " 'face 'mode-line-color-1)))) | |
(:propertize "%b" face mode-line-color-1) | |
(vc-mode | |
((:propertize "@" face mode-line-vc-face) | |
(:propertize (:eval (substring vc-mode 1)) face mode-line-vc-face) | |
(:propertize " " face mode-line-color-1)) | |
(:propertize " " face mode-line-color-1)) | |
(:propertize " %m " face mode-line-color-2) | |
;; Justify right by filling with spaces to right fringe - 17 | |
(:propertize " " display ((space :align-to (- right-fringe 17)))) | |
(:eval | |
(if (< (percent (window-end)) 100) | |
'(" " (:propertize " %p " face mode-line-color-2)) | |
'((:propertize " %p " face mode-line-color-2)))) | |
(:propertize "%4l:%2c " face mode-line-color-1))) | |
(defun percent (pos) | |
(let ((total (buffer-size))) | |
(if (> total 50000) | |
(/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1)) | |
(/ (+ (/ total 2) (* 100 (1- pos))) (max total 1))))) | |
(make-face 'mode-line-read-only-face) | |
(make-face 'mode-line-modified-face) | |
(make-face 'mode-line-vc-face) | |
(make-face 'mode-line-color-1) | |
(make-face 'mode-line-color-2) | |
(set-face-attribute 'mode-line nil | |
:foreground color-text | |
:background color3 | |
:box nil) | |
(set-face-attribute 'mode-line-inactive nil | |
:foreground color-text-inactive | |
:background color4 | |
:box nil) | |
(set-face-attribute 'mode-line-color-1 nil | |
:background color1) | |
(set-face-attribute 'mode-line-color-2 nil | |
:background color2) | |
(set-face-attribute 'mode-line-read-only-face nil | |
:inherit 'mode-line-color-1 | |
:foreground color-read-only | |
:background color1) | |
(set-face-attribute 'mode-line-modified-face nil | |
:inherit 'mode-line-color-1 | |
:foreground color-modified | |
:background color1) | |
(set-face-attribute 'mode-line-vc-face nil | |
:inherit 'mode-line-color-1 | |
:foreground color-cv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment