X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Fconfig%2Finit-color-theme.el;h=3fee5b8a79cfa44bc40ff2c481be0e93af946665;hb=03fe4ca3c2afdbeb973c9d9c0afeed2b55fd212a;hp=8205bca1c4bf55afd128568cb03ce8d0a09f35e4;hpb=592345d8e5e1849d43c400d3deee7fdc6cbf9b74;p=dotfiles.git diff --git a/emacs.d/config/init-color-theme.el b/emacs.d/config/init-color-theme.el index 8205bca..3fee5b8 100644 --- a/emacs.d/config/init-color-theme.el +++ b/emacs.d/config/init-color-theme.el @@ -7,35 +7,154 @@ (setq ns-use-srgb-colorspace nil) (require 'color-theme) -;(load-theme 'tango-dark) -;(require 'moe-theme) -;(moe-dark) - -;(add-to-list 'custom-theme-load-path "~/.emacs.d/el-get/color-theme-tangotango") -;(load-theme 'tangotango t) (load-theme 'cyberpunk t) -;(require 'color-theme-sanityinc-tomorrow) -;(color-theme-sanityinc-tomorrow-bright) +(require 'evil) +(require 'powerline) +;(require 'powerline-evil) -;(add-to-list 'load-path "~/.emacs.d/vendor/emacs-powerline") -(require 'powerline) -(powerline-default-theme) +;(set-face-attribute 'mode-line nil :font "Source Code Pro for Powerline-10") +;;; this variable should equal as height in mode-line +(custom-set-variables + '(powerline-height 14) + '(powerline-text-scale-factor 0.85)) ;; 100/140 +(custom-set-faces +;;; '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil :height 0.8 )))) +;;; '(mode-line-inactive ((t (:foreground "#f9f9f9" :background "#666666" :box nil :height 0.8))))) + '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil :family "Source Code Pro for Powerline" :height 100)))) +;; '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil :family "Source Code Pro for Powerline" :height 80)))) + '(mode-line-inactive ((t (:foreground "#f9f9f9" :background "#666666" :box nil :family "Source Code Pro for Powerline" :height 100))))) +(defface powerline-active00 '((t (:foreground "#030303" :background "#bdbdbd" :box nil :inherit mode-line))) + "Powerline face 1." + :group 'powerline) +(defface powerline-inactive00 '((t (:foreground "#f9f9f9" :background "#666666" :box nil :inherit mode-line))) + "Powerline face 1." + :group 'powerline) +(defface powerline-active11 '((t (:background "grey22" :inherit mode-line))) + "Powerline face 1." + :group 'powerline) + +(defface powerline-active22 '((t (:background "grey40" :inherit mode-line))) + "Powerline face 2." + :group 'powerline) + +(defface powerline-inactive11 '((t (:background "grey11" :inherit mode-line))) + "Powerline face 1." + :group 'powerline) + +(defface powerline-inactive22 '((t (:background "grey20" :inherit mode-line))) + "Powerline face 2." + :group 'powerline) + + +;(defface powerline-active-yel '((t (:background "yellow" :inherit mode-line))) +(defface powerline-active-yel '((t (:background "yellow" :inherit mode-line))) + "Powerline face 1." + :group 'powerline) + +(defface powerline-active-blue '((t (:background "blue" :inherit mode-line))) + "Powerline face 1." + :group 'powerline) + +;;;---------------- evil powerline +; https://github.com/raugturi/powerline-evil/blob/master/powerline-evil.el +; ;https://github.com/laynor/emacs-conf/blob/master/packages/sm-package-powerline.el +;(defface powerline-evil-base-face '((t (:foreground "white" :inherit mode-line))) +;(defface powerline-evil-base-face '((t (:foreground "black" :weight bold ))) +(defface powerline-evil-base-face '((t (:foreground "black" :weight bold :inherit mode-line))) + "Base face for powerline evil faces." + :group 'powerline) + +(defface powerline-evil-normal-face '((t (:background "green" :inherit powerline-evil-base-face))) + "Powerline face for evil NORMAL state." + :group 'powerline) + +(defface powerline-evil-insert-face '((t (:background "blue" :inherit powerline-evil-base-face))) + "Powerline face for evil INSERT state." + :group 'powerline) + +(defface powerline-evil-visual-face '((t (:background "orange" :inherit powerline-evil-base-face))) + "Powerline face for evil VISUAL state." + :group 'powerline) + +(defface powerline-evil-operator-face '((t (:background "cyan" :inherit powerline-evil-base-face))) + "Powerline face for evil OPERATOR state." + :group 'powerline) + +(defface powerline-evil-replace-face '((t (:background "red" :inherit powerline-evil-base-face))) + "Powerline face for evil REPLACE state." + :group 'powerline) + +(defface powerline-evil-motion-face '((t (:background "magenta" :inherit powerline-evil-base-face))) + "Powerline face for evil MOTION state." + :group 'powerline) + +(defface powerline-evil-emacs-face '((t (:background "violet" :inherit powerline-evil-base-face))) + "Powerline face for evil EMACS state." + :group 'powerline) + +(defun powerline-evil-face () + "Function to select appropriate face based on `evil-state'." + (let* ((face (intern (concat "powerline-evil-" (symbol-name evil-state) "-face")))) + (if (facep face) face nil))) + + + (defun powerline-evil-face (active) + (let ((face (intern (concat "powerline-evil-" (symbol-name evil-state) "-face")))) + (cond ((and active (facep face)) + face) + (active 'powerline-active22) + (t 'powerline-inactive22)))) + + (defun powerline-evil-face-22 (active) + (if (equal (symbol-name evil-state) "normal") + + (let ((face (intern (concat "powerline-evil-emacs-face")))) + face) + + (let ((face (intern (concat "powerline-evil-normal-face")))) + face) + +;; (cond ((and active (facep face)) +;; face) +;; (active 'powerline-active22) +;; (t 'powerline-inactive22))) + +;;;; (let ((face (intern (concat "powerline-evil-" (symbol-name evil-state) "-face")))) +;;;; (cond ((and active (facep face)) +;;;; face) +;;;; (active 'powerline-active22) +;;;; (t 'powerline-inactive22))) + ) + ) + + + + (defpowerline powerline-evil-tag + (concat " " (replace-regexp-in-string "[<> ]" "" (eval (evil-state-property evil-state :tag))) " ")) + + + + + +;; +;;http://emacser.com/mode-line.htm +(defun get-lines-4-mode-line () + (let ((lines (count-lines (point-min) (point-max)))) + (concat (propertize + (format "%d" lines) + 'mouse-face 'mode-line-highlight + 'face 'mode-line-lines-face + 'help-echo (format "%d lines" lines)) " "))) -;; https://github.com/howardabrams/dot-files/blob/master/emacs-mode-line.org -(custom-set-faces - '(mode-line-buffer-id ((t (:foreground "#008000" :bold t)))) - '(which-func ((t (:foreground "#008000")))) - '(mode-line ((t (:foreground "#008000" :background "#dddddd" :box nil)))) - '(mode-line-inactive ((t (:foreground "#008000" :background "#bbbbbb" :box nil))))) (defun powerline-simpler-vc-mode (s) @@ -51,6 +170,30 @@ "+1" "+2" "FlyC" "Fly" ;; ":1/0" "Fill" "AC" "FIC") "\\|")) "" s)) +(defun powerline-format-default-directory (s) + (if s + (replace-regexp-in-string "/Users/peli3/" "~/" s) + s)) + +(defun powerline-evil-tag-new () + (concat (replace-regexp-in-string "[<>]" "" (powerline-evil-tag)) " ") + ) + +;; ----------------------------------------------------------------------------- + +;; ----------------------------------------------------------------------------- +;; |evil| buffer_name | major-mode | vc | | position | pwd | time | +;; ----------------------------------------------------------------------------- +;; +;; ToDo: +;; position and pwd only shows in some mode, such as programming mode +;; using workgroup instead of pwd +;; some other modes such as eshell, package, help, don't need the posittion and +;; pwd +;; + +;; ----------------------------------------------------------------------------- + (defun powerline-ha-theme () "A powerline theme that removes many minor-modes that don't serve much purpose on the mode-line." (interactive) @@ -61,11 +204,21 @@ ((active (powerline-selected-window-active)) (mode-line - (if active 'mode-line 'mode-line-inactive)) + (if active 'powerline-active00 'powerline-inactive00)) (face1 - (if active 'powerline-active1 'powerline-inactive1)) + (if active 'powerline-active11 'powerline-inactive11)) (face2 - (if active 'powerline-active2 'powerline-inactive2)) + (if active 'powerline-active22 'powerline-inactive22)) + (face-yel + (if active 'powerline-active-yel 'powerline-inactive22)) + (face-blue + (if active 'powerline-active-blue 'powerline-inactive22)) + (pl-evil-face (ignore-errors (powerline-evil-face active))) + (pppp-face + (intern (concat "powerline-evil-" (symbol-name evil-state) "-face"))) + + (face-yel22 + (if active 'powerline-active-yel 'powerline-inactive22)) (separator-left (intern (format "powerline-%s-%s" powerline-default-separator @@ -75,75 +228,102 @@ (format "powerline-%s-%s" powerline-default-separator (cdr powerline-default-separator-dir)))) (lhs - (list - (powerline-raw "%*" nil 'l) - ;; (powerline-buffer-size nil 'l) - (powerline-buffer-id nil 'l) - (powerline-raw " ") - (funcall separator-left mode-line face1) - (powerline-narrow face1 'l) - (powerline-simpler-vc-mode (powerline-vc face1)) - )) + (list +;; (let ((evil-face (powerline-evil-face))) +;; (if evil-mode +;; (powerline-raw (powerline-evil-tag) evil-face) +;; ) +;; +;; ) + (if evil-mode + (powerline-raw (powerline-evil-tag) pl-evil-face)) +;;; (and evil-mode (funcall separator-left pppp-face face-yel)) +;;;;;; (funcall separator-left pppp-face pppp-face) +;;;; (powerline-raw (powerline-evil-tag) pppp-face face-yel) +;; (funcall separator-left (powerline-evil-face) face-yel) + + (powerline-raw "%*" face-yel 'l) + (powerline-buffer-id face-yel 'l) + (powerline-raw " " face-yel) + (funcall separator-left face-yel face-blue ) + (powerline-raw " " face-blue) + (powerline-major-mode face-blue 'r) + (funcall separator-left face-blue mode-line) + (powerline-narrow mode-line 'l) +; (powerline-vc mode-line 'r) + (powerline-simpler-vc-mode (powerline-vc mode-line 'r)) + (funcall separator-left mode-line face1))) +; (powerline-simpler-vc-mode (powerline-vc face2)))) (rhs - (list -; (powerline-raw mode-line-misc-info face1 'r) - (powerline-raw global-mode-string face1 'r) - (funcall separator-right face1 mode-line) - (powerline-raw '(:eval (propertize (format-time-string " %Y-%m-%d %I:%M %p %a") - 'help-echo - (concat (format-time-string "%c; ") - (emacs-uptime "Uptime:%hh")))) nil) - - (powerline-raw "%3c" nil) - (powerline-raw "," nil 'r) - (powerline-raw "%l" nil ) - (powerline-raw "/" nil ) - (powerline-raw '(:eval (get-lines-4-mode-line)) nil 'r) - (powerline-raw " ") - (powerline-raw "%4p" nil) -; (powerline-raw " ") - )) + (list + (funcall separator-right face1 mode-line) + ;; position + (powerline-raw (concat "%3c, %l/" (format "%d" (count-lines (point-min) (point-max))) " %4p ") mode-line) + (funcall separator-right mode-line face-blue) + ;; pwd/workgroups + (powerline-raw (concat " [" (powerline-format-default-directory default-directory) "] ") face-blue ) + (funcall separator-right face-blue face1) + ;; date and time + (powerline-raw (format-time-string " %m-%d") face1 'r) + (funcall separator-right face1 face-yel) + (powerline-raw (format-time-string " %I:%M %p %a ") face-yel 'r))) (center - (list - (powerline-raw " " face1) - (funcall separator-left face1 face2) - (when - (boundp 'erc-modified-channels-object) - (powerline-raw erc-modified-channels-object face2 'l)) - (powerline-major-mode face2 'l) - (powerline-process face2) - (powerline-raw " :" face2) - - (powerline-simpler-minor-display (powerline-minor-modes face2 'l)) - - (powerline-raw " " face2) - (funcall separator-right face2 face1)))) + (list + (powerline-raw " " face1) + (funcall separator-left face1 face2) + (when + (boundp 'erc-modified-channels-object) + (powerline-raw erc-modified-channels-object face2 'l)) + (powerline-major-mode face2 'l) + (powerline-process face2) + (powerline-raw " :" face2) + + (powerline-simpler-minor-display (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))))))) - -;;http://emacser.com/mode-line.htm -(defun get-lines-4-mode-line () - (let ((lines (count-lines (point-min) (point-max)))) - (concat (propertize - (format "%d" lines) - 'mouse-face 'mode-line-highlight - 'face 'mode-line-lines-face - 'help-echo (format "%d lines" lines)) " "))) - + (powerline-render rhs)) + ); let + ); :eval + ); '( + ); setq + ); defun (powerline-ha-theme) +;;(let ((faces '(mode-line +;; powerline-active00 +;; powerline-active11 +;; powerline-active22 +;; powerline-active-yel +;; powerline-active-blue +;; mode-line-buffer-id +;; mode-line-emphasis +;; mode-line-highlight +;; mode-line-inactive))) +;; (mapc +;;; (lambda (face) (set-face-attribute face nil :font "Source Code Pro for Powerline-10")) +;; (lambda (face) (set-face-attribute face nil :font "Courier")) +;; faces)) + + (provide 'init-color-theme) + + + +;; TODO +;; 1. change color when buffer is modified +;; 2. +;; show date and time in the right below minibuffer +