Klimi's new dotfiles with stow.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

294 řádky
18 KiB

;;; powerline-themes.el --- Themes for Powerline
;; Copyright (C) 2012-2013 Donald Ephraim Curtis
;; Copyright (C) 2013 Jason Milkins
;; Copyright (C) 2012 Nicolas Rougier
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Themes for Powerline.
;; Included themes: default, center, center-evil, vim, and nano.
;;
;;; Code:
(defcustom powerline-display-buffer-size t
"When non-nil, display the buffer size."
:group 'powerline
:type 'boolean)
(defcustom powerline-display-mule-info t
"When non-nil, display the mule info."
:group 'powerline
:type 'boolean)
(defcustom powerline-display-hud t
"When non-nil, display the hud."
:group 'powerline
:type 'boolean)
;;;###autoload
(defun powerline-default-theme ()
"Setup the default mode-line."
(interactive)
(setq-default mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
(mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
(mode-line (if active 'mode-line 'mode-line-inactive))
(face0 (if active 'powerline-active0 'powerline-inactive0))
(face1 (if active 'powerline-active1 'powerline-inactive1))
(face2 (if active 'powerline-active2 'powerline-inactive2))
(separator-left (intern (format "powerline-%s-%s"
(powerline-current-separator)
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
(powerline-current-separator)
(cdr powerline-default-separator-dir))))
(lhs (list (powerline-raw "%*" face0 'l)
(when powerline-display-buffer-size
(powerline-buffer-size face0 'l))
(when powerline-display-mule-info
(powerline-raw mode-line-mule-info face0 'l))
(powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
(when (and (boundp 'which-func-mode) which-func-mode)
(powerline-raw which-func-format face0 'l))
(powerline-raw " " face0)
(funcall separator-left face0 face1)
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face1 'l))
(powerline-major-mode face1 'l)
(powerline-process face1)
(powerline-minor-modes face1 'l)
(powerline-narrow face1 'l)
(powerline-raw " " face1)
(funcall separator-left face1 face2)
(powerline-vc face2 'r)
(when (bound-and-true-p nyan-mode)
(powerline-raw (list (nyan-create)) face2 'l))))
(rhs (list (powerline-raw global-mode-string face2 'r)
(funcall separator-right face2 face1)
(unless window-system
(powerline-raw (char-to-string #xe0a1) face1 'l))
(powerline-raw "%4l" face1 'l)
(powerline-raw ":" face1 'l)
(powerline-raw "%3c" face1 'r)
(funcall separator-right face1 face0)
(powerline-raw " " face0)
(powerline-raw "%6p" face0 'r)
(when powerline-display-hud
(powerline-hud face0 face2))
(powerline-fill face0 0)
)))
(concat (powerline-render lhs)
(powerline-fill face2 (powerline-width rhs))
(powerline-render rhs)))))))
;;;###autoload
(defun powerline-center-theme ()
"Setup a mode-line with major and minor modes centered."
(interactive)
(setq-default mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
(mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
(mode-line (if active 'mode-line 'mode-line-inactive))
(face0 (if active 'powerline-active0 'powerline-inactive0))
(face1 (if active 'powerline-active1 'powerline-inactive1))
(face2 (if active 'powerline-active2 'powerline-inactive2))
(separator-left (intern (format "powerline-%s-%s"
(powerline-current-separator)
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
(powerline-current-separator)
(cdr powerline-default-separator-dir))))
(lhs (list (powerline-raw "%*" face0 'l)
(when powerline-display-buffer-size
(powerline-buffer-size face0 'l))
(powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
(powerline-raw " " face0)
(funcall separator-left face0 face1)
(powerline-narrow face1 'l)
(powerline-vc face1)))
(rhs (list (powerline-raw global-mode-string face1 'r)
(powerline-raw "%4l" face1 'r)
(powerline-raw ":" face1)
(powerline-raw "%3c" face1 'r)
(funcall separator-right face1 face0)
(powerline-raw " " face0)
(powerline-raw "%6p" face0 'r)
(when powerline-display-hud
(powerline-hud face2 face1))
(powerline-fill face0 0)))
(center (list (powerline-raw " " face1)
(funcall separator-left face1 face2)
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face2 'l))
(powerline-major-mode face2 'l)
(powerline-process face2)
(powerline-raw " :" face2)
(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)))))))
(defun powerline-center-evil-theme ()
"Setup a mode-line with major, evil, and minor modes centered."
(interactive)
(setq-default mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
(mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
(mode-line (if active 'mode-line 'mode-line-inactive))
(face0 (if active 'powerline-active0 'powerline-inactive0))
(face1 (if active 'powerline-active1 'powerline-inactive1))
(face2 (if active 'powerline-active2 'powerline-inactive2))
(separator-left (intern (format "powerline-%s-%s"
(powerline-current-separator)
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
(powerline-current-separator)
(cdr powerline-default-separator-dir))))
(lhs (list (powerline-raw "%*" face0 'l)
(when powerline-display-buffer-size
(powerline-buffer-size face0 'l))
(powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
(powerline-raw " " face0)
(funcall separator-left face0 face1)
(powerline-narrow face1 'l)
(powerline-vc face1)))
(rhs (list (powerline-raw global-mode-string face1 'r)
(powerline-raw "%4l" face1 'r)
(powerline-raw ":" face1)
(powerline-raw "%3c" face1 'r)
(funcall separator-right face1 face0)
(powerline-raw " " face0)
(powerline-raw "%6p" face0 'r)
(when powerline-display-hud
(powerline-hud face2 face1))))
(center (append (list (powerline-raw " " face1)
(funcall separator-left face1 face2)
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face2 'l))
(powerline-major-mode face2 'l)
(powerline-process face2)
(powerline-raw " " face2))
(if (split-string (format-mode-line minor-mode-alist))
(append (if evil-mode
(list (funcall separator-right face2 face1)
(powerline-raw evil-mode-line-tag face1 'l)
(powerline-raw " " face1)
(funcall separator-left face1 face2)))
(list (powerline-minor-modes face2 'l)
(powerline-raw " " face2)
(funcall separator-right face2 face1)))
(list (powerline-raw evil-mode-line-tag 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)))))))
;;;###autoload
(defun powerline-vim-theme ()
"Setup a Vim-like 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))
(face0 (if active 'powerline-active0 'powerline-inactive0))
(face1 (if active 'powerline-active1 'powerline-inactive1))
(face2 (if active 'powerline-active2 'powerline-inactive2))
(separator-left (intern (format "powerline-%s-%s"
(powerline-current-separator)
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
(powerline-current-separator)
(cdr powerline-default-separator-dir))))
(lhs (list (powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
(powerline-raw "[" face0 'l)
(powerline-major-mode face0)
(powerline-process face0)
(powerline-raw "]" face0)
(when (buffer-modified-p)
(powerline-raw "[+]" face0))
(when buffer-read-only
(powerline-raw "[RO]" face0))
(powerline-raw "[%z]" face0)
;; (powerline-raw (concat "[" (mode-line-eol-desc) "]") face0)
(when (and (boundp 'which-func-mode) which-func-mode)
(powerline-raw which-func-format nil 'l))
(when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
(powerline-raw erc-modified-channels-object face1 'l))
(powerline-raw "[" face0 'l)
(powerline-minor-modes face0)
(powerline-raw "%n" face0)
(powerline-raw "]" face0)
(when (and vc-mode buffer-file-name)
(let ((backend (vc-backend buffer-file-name)))
(when backend
(concat (powerline-raw "[" face0 'l)
(powerline-raw (format "%s / %s" backend (vc-working-revision buffer-file-name backend)) face0)
(powerline-raw "]" face0)))))))
(rhs (list (powerline-raw '(10 "%i") face0)
(powerline-raw global-mode-string face0 'r)
(powerline-raw "%l," face0 'l)
(powerline-raw (format-mode-line '(10 "%c")) face0)
(powerline-raw (replace-regexp-in-string "%" "%%" (format-mode-line '(-3 "%p"))) face0 'r)
(powerline-fill face0 0))))
(concat (powerline-render lhs)
(powerline-fill face0 (powerline-width rhs))
(powerline-render rhs)))))))
;;;###autoload
(defun powerline-nano-theme ()
"Setup a nano-like mode-line."
(interactive)
(setq-default mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
(face0 (if active 'powerline-active0 'powerline-inactive0))
(lhs (list (powerline-raw (concat "GNU Emacs "
(number-to-string
emacs-major-version)
"."
(number-to-string
emacs-minor-version))
face0 'l)))
(rhs (list (if (buffer-modified-p) (powerline-raw "Modified" face0 'r))
(powerline-fill face0 0)))
(center (list (powerline-raw "%b" face0))))
(concat (powerline-render lhs)
(powerline-fill-center face0 (/ (powerline-width center) 2.0))
(powerline-render center)
(powerline-fill face0 (powerline-width rhs))
(powerline-render rhs)))))))
(provide 'powerline-themes)
;;; powerline-themes.el ends here