Klimi's new dotfiles with stow.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

294 строки
18 KiB

4 лет назад
  1. ;;; powerline-themes.el --- Themes for Powerline
  2. ;; Copyright (C) 2012-2013 Donald Ephraim Curtis
  3. ;; Copyright (C) 2013 Jason Milkins
  4. ;; Copyright (C) 2012 Nicolas Rougier
  5. ;; This file is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation; either version 3, or (at your option)
  8. ;; any later version.
  9. ;; This file is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;;
  17. ;; Themes for Powerline.
  18. ;; Included themes: default, center, center-evil, vim, and nano.
  19. ;;
  20. ;;; Code:
  21. (defcustom powerline-display-buffer-size t
  22. "When non-nil, display the buffer size."
  23. :group 'powerline
  24. :type 'boolean)
  25. (defcustom powerline-display-mule-info t
  26. "When non-nil, display the mule info."
  27. :group 'powerline
  28. :type 'boolean)
  29. (defcustom powerline-display-hud t
  30. "When non-nil, display the hud."
  31. :group 'powerline
  32. :type 'boolean)
  33. ;;;###autoload
  34. (defun powerline-default-theme ()
  35. "Setup the default mode-line."
  36. (interactive)
  37. (setq-default mode-line-format
  38. '("%e"
  39. (:eval
  40. (let* ((active (powerline-selected-window-active))
  41. (mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
  42. (mode-line (if active 'mode-line 'mode-line-inactive))
  43. (face0 (if active 'powerline-active0 'powerline-inactive0))
  44. (face1 (if active 'powerline-active1 'powerline-inactive1))
  45. (face2 (if active 'powerline-active2 'powerline-inactive2))
  46. (separator-left (intern (format "powerline-%s-%s"
  47. (powerline-current-separator)
  48. (car powerline-default-separator-dir))))
  49. (separator-right (intern (format "powerline-%s-%s"
  50. (powerline-current-separator)
  51. (cdr powerline-default-separator-dir))))
  52. (lhs (list (powerline-raw "%*" face0 'l)
  53. (when powerline-display-buffer-size
  54. (powerline-buffer-size face0 'l))
  55. (when powerline-display-mule-info
  56. (powerline-raw mode-line-mule-info face0 'l))
  57. (powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
  58. (when (and (boundp 'which-func-mode) which-func-mode)
  59. (powerline-raw which-func-format face0 'l))
  60. (powerline-raw " " face0)
  61. (funcall separator-left face0 face1)
  62. (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
  63. (powerline-raw erc-modified-channels-object face1 'l))
  64. (powerline-major-mode face1 'l)
  65. (powerline-process face1)
  66. (powerline-minor-modes face1 'l)
  67. (powerline-narrow face1 'l)
  68. (powerline-raw " " face1)
  69. (funcall separator-left face1 face2)
  70. (powerline-vc face2 'r)
  71. (when (bound-and-true-p nyan-mode)
  72. (powerline-raw (list (nyan-create)) face2 'l))))
  73. (rhs (list (powerline-raw global-mode-string face2 'r)
  74. (funcall separator-right face2 face1)
  75. (unless window-system
  76. (powerline-raw (char-to-string #xe0a1) face1 'l))
  77. (powerline-raw "%4l" face1 'l)
  78. (powerline-raw ":" face1 'l)
  79. (powerline-raw "%3c" face1 'r)
  80. (funcall separator-right face1 face0)
  81. (powerline-raw " " face0)
  82. (powerline-raw "%6p" face0 'r)
  83. (when powerline-display-hud
  84. (powerline-hud face0 face2))
  85. (powerline-fill face0 0)
  86. )))
  87. (concat (powerline-render lhs)
  88. (powerline-fill face2 (powerline-width rhs))
  89. (powerline-render rhs)))))))
  90. ;;;###autoload
  91. (defun powerline-center-theme ()
  92. "Setup a mode-line with major and minor modes centered."
  93. (interactive)
  94. (setq-default mode-line-format
  95. '("%e"
  96. (:eval
  97. (let* ((active (powerline-selected-window-active))
  98. (mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
  99. (mode-line (if active 'mode-line 'mode-line-inactive))
  100. (face0 (if active 'powerline-active0 'powerline-inactive0))
  101. (face1 (if active 'powerline-active1 'powerline-inactive1))
  102. (face2 (if active 'powerline-active2 'powerline-inactive2))
  103. (separator-left (intern (format "powerline-%s-%s"
  104. (powerline-current-separator)
  105. (car powerline-default-separator-dir))))
  106. (separator-right (intern (format "powerline-%s-%s"
  107. (powerline-current-separator)
  108. (cdr powerline-default-separator-dir))))
  109. (lhs (list (powerline-raw "%*" face0 'l)
  110. (when powerline-display-buffer-size
  111. (powerline-buffer-size face0 'l))
  112. (powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
  113. (powerline-raw " " face0)
  114. (funcall separator-left face0 face1)
  115. (powerline-narrow face1 'l)
  116. (powerline-vc face1)))
  117. (rhs (list (powerline-raw global-mode-string face1 'r)
  118. (powerline-raw "%4l" face1 'r)
  119. (powerline-raw ":" face1)
  120. (powerline-raw "%3c" face1 'r)
  121. (funcall separator-right face1 face0)
  122. (powerline-raw " " face0)
  123. (powerline-raw "%6p" face0 'r)
  124. (when powerline-display-hud
  125. (powerline-hud face2 face1))
  126. (powerline-fill face0 0)))
  127. (center (list (powerline-raw " " face1)
  128. (funcall separator-left face1 face2)
  129. (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
  130. (powerline-raw erc-modified-channels-object face2 'l))
  131. (powerline-major-mode face2 'l)
  132. (powerline-process face2)
  133. (powerline-raw " :" face2)
  134. (powerline-minor-modes face2 'l)
  135. (powerline-raw " " face2)
  136. (funcall separator-right face2 face1))))
  137. (concat (powerline-render lhs)
  138. (powerline-fill-center face1 (/ (powerline-width center) 2.0))
  139. (powerline-render center)
  140. (powerline-fill face1 (powerline-width rhs))
  141. (powerline-render rhs)))))))
  142. (defun powerline-center-evil-theme ()
  143. "Setup a mode-line with major, evil, and minor modes centered."
  144. (interactive)
  145. (setq-default mode-line-format
  146. '("%e"
  147. (:eval
  148. (let* ((active (powerline-selected-window-active))
  149. (mode-line-buffer-id (if active 'mode-line-buffer-id 'mode-line-buffer-id-inactive))
  150. (mode-line (if active 'mode-line 'mode-line-inactive))
  151. (face0 (if active 'powerline-active0 'powerline-inactive0))
  152. (face1 (if active 'powerline-active1 'powerline-inactive1))
  153. (face2 (if active 'powerline-active2 'powerline-inactive2))
  154. (separator-left (intern (format "powerline-%s-%s"
  155. (powerline-current-separator)
  156. (car powerline-default-separator-dir))))
  157. (separator-right (intern (format "powerline-%s-%s"
  158. (powerline-current-separator)
  159. (cdr powerline-default-separator-dir))))
  160. (lhs (list (powerline-raw "%*" face0 'l)
  161. (when powerline-display-buffer-size
  162. (powerline-buffer-size face0 'l))
  163. (powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
  164. (powerline-raw " " face0)
  165. (funcall separator-left face0 face1)
  166. (powerline-narrow face1 'l)
  167. (powerline-vc face1)))
  168. (rhs (list (powerline-raw global-mode-string face1 'r)
  169. (powerline-raw "%4l" face1 'r)
  170. (powerline-raw ":" face1)
  171. (powerline-raw "%3c" face1 'r)
  172. (funcall separator-right face1 face0)
  173. (powerline-raw " " face0)
  174. (powerline-raw "%6p" face0 'r)
  175. (when powerline-display-hud
  176. (powerline-hud face2 face1))))
  177. (center (append (list (powerline-raw " " face1)
  178. (funcall separator-left face1 face2)
  179. (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
  180. (powerline-raw erc-modified-channels-object face2 'l))
  181. (powerline-major-mode face2 'l)
  182. (powerline-process face2)
  183. (powerline-raw " " face2))
  184. (if (split-string (format-mode-line minor-mode-alist))
  185. (append (if evil-mode
  186. (list (funcall separator-right face2 face1)
  187. (powerline-raw evil-mode-line-tag face1 'l)
  188. (powerline-raw " " face1)
  189. (funcall separator-left face1 face2)))
  190. (list (powerline-minor-modes face2 'l)
  191. (powerline-raw " " face2)
  192. (funcall separator-right face2 face1)))
  193. (list (powerline-raw evil-mode-line-tag face2)
  194. (funcall separator-right face2 face1))))))
  195. (concat (powerline-render lhs)
  196. (powerline-fill-center face1 (/ (powerline-width center) 2.0))
  197. (powerline-render center)
  198. (powerline-fill face1 (powerline-width rhs))
  199. (powerline-render rhs)))))))
  200. ;;;###autoload
  201. (defun powerline-vim-theme ()
  202. "Setup a Vim-like mode-line."
  203. (interactive)
  204. (setq-default mode-line-format
  205. '("%e"
  206. (:eval
  207. (let* ((active (powerline-selected-window-active))
  208. (mode-line (if active 'mode-line 'mode-line-inactive))
  209. (face0 (if active 'powerline-active0 'powerline-inactive0))
  210. (face1 (if active 'powerline-active1 'powerline-inactive1))
  211. (face2 (if active 'powerline-active2 'powerline-inactive2))
  212. (separator-left (intern (format "powerline-%s-%s"
  213. (powerline-current-separator)
  214. (car powerline-default-separator-dir))))
  215. (separator-right (intern (format "powerline-%s-%s"
  216. (powerline-current-separator)
  217. (cdr powerline-default-separator-dir))))
  218. (lhs (list (powerline-buffer-id `(mode-line-buffer-id ,face0) 'l)
  219. (powerline-raw "[" face0 'l)
  220. (powerline-major-mode face0)
  221. (powerline-process face0)
  222. (powerline-raw "]" face0)
  223. (when (buffer-modified-p)
  224. (powerline-raw "[+]" face0))
  225. (when buffer-read-only
  226. (powerline-raw "[RO]" face0))
  227. (powerline-raw "[%z]" face0)
  228. ;; (powerline-raw (concat "[" (mode-line-eol-desc) "]") face0)
  229. (when (and (boundp 'which-func-mode) which-func-mode)
  230. (powerline-raw which-func-format nil 'l))
  231. (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
  232. (powerline-raw erc-modified-channels-object face1 'l))
  233. (powerline-raw "[" face0 'l)
  234. (powerline-minor-modes face0)
  235. (powerline-raw "%n" face0)
  236. (powerline-raw "]" face0)
  237. (when (and vc-mode buffer-file-name)
  238. (let ((backend (vc-backend buffer-file-name)))
  239. (when backend
  240. (concat (powerline-raw "[" face0 'l)
  241. (powerline-raw (format "%s / %s" backend (vc-working-revision buffer-file-name backend)) face0)
  242. (powerline-raw "]" face0)))))))
  243. (rhs (list (powerline-raw '(10 "%i") face0)
  244. (powerline-raw global-mode-string face0 'r)
  245. (powerline-raw "%l," face0 'l)
  246. (powerline-raw (format-mode-line '(10 "%c")) face0)
  247. (powerline-raw (replace-regexp-in-string "%" "%%" (format-mode-line '(-3 "%p"))) face0 'r)
  248. (powerline-fill face0 0))))
  249. (concat (powerline-render lhs)
  250. (powerline-fill face0 (powerline-width rhs))
  251. (powerline-render rhs)))))))
  252. ;;;###autoload
  253. (defun powerline-nano-theme ()
  254. "Setup a nano-like mode-line."
  255. (interactive)
  256. (setq-default mode-line-format
  257. '("%e"
  258. (:eval
  259. (let* ((active (powerline-selected-window-active))
  260. (face0 (if active 'powerline-active0 'powerline-inactive0))
  261. (lhs (list (powerline-raw (concat "GNU Emacs "
  262. (number-to-string
  263. emacs-major-version)
  264. "."
  265. (number-to-string
  266. emacs-minor-version))
  267. face0 'l)))
  268. (rhs (list (if (buffer-modified-p) (powerline-raw "Modified" face0 'r))
  269. (powerline-fill face0 0)))
  270. (center (list (powerline-raw "%b" face0))))
  271. (concat (powerline-render lhs)
  272. (powerline-fill-center face0 (/ (powerline-width center) 2.0))
  273. (powerline-render center)
  274. (powerline-fill face0 (powerline-width rhs))
  275. (powerline-render rhs)))))))
  276. (provide 'powerline-themes)
  277. ;;; powerline-themes.el ends here