My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init-powerline.el 5.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. (defface my-pl-segment1-active
  2. '((t (:foreground "#000000" :background "#E1B61A")))
  3. "Powerline first segment active face.")
  4. (defface my-pl-segment1-inactive
  5. '((t (:foreground "#CEBFF3" :background "#3A2E58")))
  6. "Powerline first segment inactive face.")
  7. (defface my-pl-segment2-active
  8. '((t (:foreground "#F5E39F" :background "#8A7119")))
  9. "Powerline second segment active face.")
  10. (defface my-pl-segment2-inactive
  11. '((t (:foreground "#CEBFF3" :background "#3A2E58")))
  12. "Powerline second segment inactive face.")
  13. (defface my-pl-segment3-active
  14. '((t (:foreground "#CEBFF3" :background "#3A2E58")))
  15. "Powerline third segment active face.")
  16. (defface my-pl-segment3-inactive
  17. '((t (:foreground "#CEBFF3" :background "#3A2E58")))
  18. "Powerline third segment inactive face.")
  19. (defun air--powerline-default-theme ()
  20. "Set up my custom Powerline with Evil indicators."
  21. (interactive)
  22. (setq-default mode-line-format
  23. '("%e"
  24. (:eval
  25. (let* ((active (powerline-selected-window-active))
  26. (seg1 (if active 'my-pl-segment1-active 'my-pl-segment1-inactive))
  27. (seg2 (if active 'my-pl-segment2-active 'my-pl-segment2-inactive))
  28. (seg3 (if active 'my-pl-segment3-active 'my-pl-segment3-inactive))
  29. (separator-left (intern (format "powerline-%s-%s"
  30. (powerline-current-separator)
  31. (car powerline-default-separator-dir))))
  32. (separator-right (intern (format "powerline-%s-%s"
  33. (powerline-current-separator)
  34. (cdr powerline-default-separator-dir))))
  35. (lhs (list (let ((evil-face (powerline-evil-face)))
  36. (if evil-mode
  37. (powerline-raw (powerline-evil-tag) evil-face)
  38. ))
  39. (if evil-mode
  40. (funcall separator-left (powerline-evil-face) seg1))
  41. ;;(when powerline-display-buffer-size
  42. ;; (powerline-buffer-size nil 'l))
  43. ;;(when powerline-display-mule-info
  44. ;; (powerline-raw mode-line-mule-info nil 'l))
  45. (powerline-buffer-id seg1 'l)
  46. (powerline-raw "[%*]" seg1 'l)
  47. (when (and (boundp 'which-func-mode) which-func-mode)
  48. (powerline-raw which-func-format seg1 'l))
  49. (powerline-raw " " seg1)
  50. (funcall separator-left seg1 seg2)
  51. (when (boundp 'erc-modified-channels-object)
  52. (powerline-raw erc-modified-channels-object seg2 'l))
  53. (powerline-major-mode seg2 'l)
  54. (powerline-process seg2)
  55. (powerline-minor-modes seg2 'l)
  56. (powerline-narrow seg2 'l)
  57. (powerline-raw " " seg2)
  58. (funcall separator-left seg2 seg3)
  59. (powerline-vc seg3 'r)
  60. (when (bound-and-true-p nyan-mode)
  61. (powerline-raw (list (nyan-create)) seg3 'l))))
  62. (rhs (list (powerline-raw global-mode-string seg3 'r)
  63. (funcall separator-right seg3 seg2)
  64. (unless window-system
  65. (powerline-raw (char-to-string #xe0a1) seg2 'l))
  66. (powerline-raw "%4l" seg2 'l)
  67. (powerline-raw ":" seg2 'l)
  68. (powerline-raw "%3c" seg2 'r)
  69. (funcall separator-right seg2 seg1)
  70. (powerline-raw " " seg1)
  71. (powerline-raw "%6p" seg1 'r)
  72. (when powerline-display-hud
  73. (powerline-hud seg1 seg3)))))
  74. (concat (powerline-render lhs)
  75. (powerline-fill seg3 (powerline-width rhs))
  76. (powerline-render rhs)))))))
  77. (use-package powerline
  78. :ensure t
  79. :config
  80. (setq powerline-default-separator (if (display-graphic-p) 'slant
  81. nil))
  82. (air--powerline-default-theme))
  83. (use-package powerline-evil
  84. :ensure t)
  85. (provide 'init-powerline)