Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defvar powerline-color1)
- (defvar powerline-color2)
- (setq powerline-color1 "grey22")
- (setq powerline-color2 "grey40")
- (set-face-attribute 'mode-line nil
- ; "IndianRed4"
- :box nil)
- (set-face-attribute 'mode-line-inactive nil
- :box nil)
- (defun arrow-right-xpm (color1 color2)
- "Return an XPM right arrow string representing."
- (create-image
- (format "/* XPM */
- static char * arrow_right[] = {
- \"12 18 2 1\",
- \". c %s\",
- \" c %s\",
- \". \",
- \".. \",
- \"... \",
- \".... \",
- \"..... \",
- \"...... \",
- \"....... \",
- \"........ \",
- \"......... \",
- \"......... \",
- \"........ \",
- \"....... \",
- \"...... \",
- \"..... \",
- \".... \",
- \"... \",
- \".. \",
- \". \"};"
- (if color1 color1 "None")
- (if color2 color2 "None"))
- 'xpm t :ascent 'center))
- (defun arrow-left-xpm (color1 color2)
- "Return an XPM right arrow string representing."
- (create-image
- (format "/* XPM */
- static char * arrow_right[] = {
- \"12 18 2 1\",
- \". c %s\",
- \" c %s\",
- \" .\",
- \" ..\",
- \" ...\",
- \" ....\",
- \" .....\",
- \" ......\",
- \" .......\",
- \" ........\",
- \" .........\",
- \" .........\",
- \" ........\",
- \" .......\",
- \" ......\",
- \" .....\",
- \" ....\",
- \" ...\",
- \" ..\",
- \" .\"};"
- (if color2 color2 "None")
- (if color1 color1 "None"))
- 'xpm t :ascent 'center))
- (defvar powerline-minor-modes nil)
- (defun powerline-make-face (bg &optional fg)
- (if bg
- (let ((cface (intern (concat "powerline-" bg))))
- (make-face cface)
- (set-face-attribute cface nil
- :foreground (if fg fg "white")
- :background bg
- :box nil)
- cface)
- nil))
- (defun powerline-make-left (string color1 color2 &optional localmap)
- (let ((plface (powerline-make-face color1)))
- (concat
- (if localmap
- (propertize string 'face plface 'mouse-face plface 'local-map localmap)
- (propertize string 'face plface))
- (propertize " " 'display (arrow-right-xpm color1 color2)))))
- (defun powerline-make-right (string color1 color2 &optional localmap)
- (let ((plface (powerline-make-face color2)))
- (concat
- (propertize " " 'display (arrow-left-xpm color1 color2))
- (if localmap
- (propertize string 'face plface 'mouse-face plface 'local-map localmap)
- (propertize string 'face plface)))))
- (defun powerline-make-center (color)
- ;; justify right by filling with spaces to right fringe, 20 should be calculated
- (propertize " " 'display '((space :align-to (- right-fringe 20)))
- 'face (powerline-make-face color)))
- (defun powerline-make (side color1 color2 string &optional localmap)
- (cond ((eq side 'right) (powerline-make-right string color2 color1 localmap))
- (t (powerline-make-left string color1 color2 localmap))))
- (defun powerline-buffer-info (side color1 color2)
- (powerline-make side color1 color2 " %* %I %b "))
- (defun powerline-modelist (side color1 color2)
- (powerline-make side color1 color2
- (if powerline-minor-modes
- (concat " %[%m%]" (format-mode-line minor-mode-alist) " ")
- " %[%m%] ")
- (make-mode-line-mouse-map
- 'mouse-1 (lambda () (interactive)
- (setq powerline-minor-modes (not powerline-minor-modes))
- (redraw-modeline)))))
- (defun powerline-scroll (side color1 color2)
- (powerline-make side color1 color2 " %6p "))
- (defun powerline-row-column (side color1 color2)
- (powerline-make side color1 color2 "%4l:%2c "))
- (setq-default mode-line-format
- (list '(:eval (powerline-buffer-info 'left nil powerline-color1 ))
- '(:eval (powerline-modelist 'left powerline-color1 powerline-color2 ))
- '(:eval (powerline-make-center powerline-color2 ))
- '(:eval (powerline-scroll 'right powerline-color1 powerline-color2 ))
- '(:eval (powerline-row-column 'right nil powerline-color1 ))))
- (provide 'powerline)
Add Comment
Please, Sign In to add comment