Merge pull request #19 from trishume/master

Fix powerline separators and make them configurable
This commit is contained in:
Sylvain Benner 2014-10-18 21:20:57 -04:00
commit c6acb276bf

View file

@ -300,7 +300,7 @@ inserted in the buffer (if it is not read-only)."
(progn (progn
;; Unset shortcuts which shadow evil leader ;; Unset shortcuts which shadow evil leader
(eval-after-load "compile" (eval-after-load "compile"
'(progn '(progn
(define-key compilation-mode-map (kbd "SPC") nil) (define-key compilation-mode-map (kbd "SPC") nil)
(define-key compilation-mode-map (kbd "h") nil))) (define-key compilation-mode-map (kbd "h") nil)))
(eval-after-load "dired" (eval-after-load "dired"
@ -311,7 +311,7 @@ inserted in the buffer (if it is not read-only)."
(define-key evil-emacs-state-map (kbd "SPC") evil-leader--default-map))) (define-key evil-emacs-state-map (kbd "SPC") evil-leader--default-map)))
;; load surround ;; load surround
(use-package evil-surround (use-package evil-surround
:init (global-evil-surround-mode 1)) :init (global-evil-surround-mode 1))
;; load evil-exchange ;; load evil-exchange
(use-package evil-exchange (use-package evil-exchange
:init (evil-exchange-install)) :init (evil-exchange-install))
@ -380,9 +380,11 @@ inserted in the buffer (if it is not read-only)."
(setq spacemacs-mode-line-flycheckp nil) (setq spacemacs-mode-line-flycheckp nil)
(setq spacemacs-mode-line-flycheckp t))) (setq spacemacs-mode-line-flycheckp t)))
(evil-leader/set-key "tmf" 'spacemacs/mode-line-flycheck-info-toggle) (evil-leader/set-key "tmf" 'spacemacs/mode-line-flycheck-info-toggle)
(setq-default powerline-height 17)
(setq-default powerline-default-separator 'wave)
(setq-default mode-line-format '("%e" (:eval (setq-default mode-line-format '("%e" (:eval
(let* ((active (eq (frame-selected-window) (selected-window))) (let* ((active (eq (frame-selected-window) (selected-window)))
(line-face (if active 'mode-line 'mode-line-inactive))
(face1 (if active 'powerline-active1 'powerline-inactive1)) (face1 (if active 'powerline-active1 'powerline-inactive1))
(face2 (if active 'powerline-active2 'powerline-inactive2)) (face2 (if active 'powerline-active2 'powerline-inactive2))
(state-face (if active (spacemacs/current-state-face) face2)) (state-face (if active (spacemacs/current-state-face) face2))
@ -393,24 +395,30 @@ inserted in the buffer (if it is not read-only)."
(eq 'running flycheck-last-status-change)))) (eq 'running flycheck-last-status-change))))
(vc-face (if (or flycheckp spacemacs-mode-line-minor-modesp) (vc-face (if (or flycheckp spacemacs-mode-line-minor-modesp)
face1 nil)) face1 nil))
(separator-left (intern (format "powerline-%s-%s"
powerline-default-separator
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
powerline-default-separator
(cdr powerline-default-separator-dir))))
(lhs (append (list (lhs (append (list
;; window number ;; window number
;; (powerline-wave-left state-face face1) ;; (funcall separator-left state-face face1)
(powerline-raw (spacemacs/window-number) state-face) (powerline-raw (spacemacs/window-number) state-face)
(powerline-wave-right state-face nil) (funcall separator-right state-face line-face)
;; evil state ;; evil state
;; (powerline-raw evil-mode-line-tag state-face) ;; (powerline-raw evil-mode-line-tag state-face)
;; (powerline-wave-right state-face nil) ;; (funcall separator-right state-face nil)
;; buffer name ;; buffer name
(powerline-raw "%*" nil 'l) (powerline-raw "%*" nil 'l)
(powerline-buffer-size nil 'l) (powerline-buffer-size nil 'l)
(powerline-buffer-id nil 'l) (powerline-buffer-id nil 'l)
(powerline-raw " " nil) (powerline-raw " " nil)
;; major mode ;; major mode
(powerline-wave-left nil face1) (funcall separator-left line-face face1)
(powerline-major-mode face1 'l) (powerline-major-mode face1 'l)
(powerline-raw " " face1) (powerline-raw " " face1)
(powerline-wave-right face1 nil)) (funcall separator-right face1 line-face))
;; flycheck ;; flycheck
(if flycheckp (if flycheckp
(list (list
@ -424,9 +432,9 @@ inserted in the buffer (if it is not read-only)."
;; separator between flycheck and minor modes ;; separator between flycheck and minor modes
(if (and flycheckp spacemacs-mode-line-minor-modesp) (if (and flycheckp spacemacs-mode-line-minor-modesp)
(list (list
(powerline-wave-left nil face1) (funcall separator-left line-face face1)
(powerline-raw " " face1) (powerline-raw " " face1)
(powerline-wave-right face1 nil))) (funcall separator-right face1 line-face)))
;; minor modes ;; minor modes
(if spacemacs-mode-line-minor-modesp (if spacemacs-mode-line-minor-modesp
(list (list
@ -435,19 +443,19 @@ inserted in the buffer (if it is not read-only)."
(powerline-raw " " nil))) (powerline-raw " " nil)))
;; version control ;; version control
(if (or flycheckp spacemacs-mode-line-minor-modesp) (if (or flycheckp spacemacs-mode-line-minor-modesp)
(list (powerline-wave-left (if vc-face nil face1) vc-face))) (list (funcall separator-left (if vc-face line-face face1) vc-face)))
(list (list
(powerline-vc vc-face) (powerline-vc vc-face)
(powerline-raw " " vc-face) (powerline-raw " " vc-face)
(powerline-wave-right vc-face face2)))) (funcall separator-right vc-face face2))))
(rhs (list (rhs (list
(powerline-wave-right face2 face1) (funcall separator-right face2 face1)
(powerline-raw " " face1) (powerline-raw " " face1)
(powerline-raw "%l:%2c" face1 'r) (powerline-raw "%l:%2c" face1 'r)
(powerline-wave-left face1 nil) (funcall separator-left face1 line-face)
(powerline-raw " " nil) (powerline-raw " " nil)
(powerline-raw "%p" nil 'r) (powerline-raw "%p" nil 'r)
(powerline-chamfer-left nil face1) (powerline-chamfer-left line-face face1)
;; display hud only if necessary ;; display hud only if necessary
(let ((progress (format-mode-line "%p"))) (let ((progress (format-mode-line "%p")))
(if (string-match "\%" progress) (if (string-match "\%" progress)
@ -473,12 +481,12 @@ inserted in the buffer (if it is not read-only)."
(use-package ace-jump-mode (use-package ace-jump-mode
:defer t :defer t
:init :init
(progn (progn
(add-hook 'ace-jump-mode-end-hook 'golden-ratio) (add-hook 'ace-jump-mode-end-hook 'golden-ratio)
(evil-leader/set-key "SPC" 'evil-ace-jump-char-mode) (evil-leader/set-key "SPC" 'evil-ace-jump-char-mode)
(evil-leader/set-key "l" 'evil-ace-jump-line-mode)) (evil-leader/set-key "l" 'evil-ace-jump-line-mode))
:config :config
(progn (progn
(setq ace-jump-mode-scope 'global) (setq ace-jump-mode-scope 'global)
(evil-leader/set-key "`" 'ace-jump-mode-pop-mark)))) (evil-leader/set-key "`" 'ace-jump-mode-pop-mark))))
@ -486,7 +494,7 @@ inserted in the buffer (if it is not read-only)."
(use-package auto-complete (use-package auto-complete
:commands auto-complete-mode :commands auto-complete-mode
:init :init
(progn (progn
(add-to-hooks 'auto-complete-mode '(org-mode-hook (add-to-hooks 'auto-complete-mode '(org-mode-hook
prog-mode-hook prog-mode-hook
erlang-mode-hook)) erlang-mode-hook))
@ -531,7 +539,7 @@ inserted in the buffer (if it is not read-only)."
:disabled t :disabled t
:defer t :defer t
:init :init
(progn (progn
(add-hook 'flyspell-mode-hook '(lambda () (auto-dictionary-mode 1))) (add-hook 'flyspell-mode-hook '(lambda () (auto-dictionary-mode 1)))
(evil-leader/set-key (evil-leader/set-key
"sd" 'adict-change-dictionary)))) "sd" 'adict-change-dictionary))))
@ -543,7 +551,7 @@ inserted in the buffer (if it is not read-only)."
bookmark-rename bookmark-rename
bookmark-set) bookmark-set)
:config :config
(setq (setq
bookmark-default-file "~/.emacs.d/bookmarks" ; keep my ~/ clean bookmark-default-file "~/.emacs.d/bookmarks" ; keep my ~/ clean
bookmark-save-flag 1))) ; autosave each change bookmark-save-flag 1))) ; autosave each change
@ -664,7 +672,7 @@ inserted in the buffer (if it is not read-only)."
;; (require 'erlang-flymake) ;; (require 'erlang-flymake)
;; (erlang-flymake-only-on-save) ;; (erlang-flymake-only-on-save)
) )
(defun spacemacs/init-ess () (defun spacemacs/init-ess ()
;; ESS is not quick to load so we just load it when ;; ESS is not quick to load so we just load it when
;; we need it (see my-keybindings.el for the associated ;; we need it (see my-keybindings.el for the associated
@ -925,7 +933,7 @@ inserted in the buffer (if it is not read-only)."
(progn (golden-ratio-mode -1)(balance-windows)) (progn (golden-ratio-mode -1)(balance-windows))
(golden-ratio-mode)))) (golden-ratio-mode))))
:config :config
(progn (progn
(setq golden-ratio-extra-commands (setq golden-ratio-extra-commands
(append golden-ratio-extra-commands (append golden-ratio-extra-commands
'(evil-window-left '(evil-window-left
@ -1191,7 +1199,7 @@ inserted in the buffer (if it is not read-only)."
(use-package ledger-mode (use-package ledger-mode
:mode ("\\.ledger\\'" . ledger-mode) :mode ("\\.ledger\\'" . ledger-mode)
:init :init
(progn (progn
(setq ledger-post-amount-alignment-column 62) (setq ledger-post-amount-alignment-column 62)
(evil-leader/set-key-for-mode 'ledger-mode (evil-leader/set-key-for-mode 'ledger-mode
"md" 'ledger-delete-current-transaction "md" 'ledger-delete-current-transaction
@ -1283,7 +1291,7 @@ inserted in the buffer (if it is not read-only)."
(use-package neotree (use-package neotree
:defer t :defer t
:init :init
(progn (progn
(setq neo-create-file-auto-open t (setq neo-create-file-auto-open t
neo-dont-be-alone t neo-dont-be-alone t
neo-banner-message "File Tree browser" neo-banner-message "File Tree browser"
@ -1611,7 +1619,7 @@ inserted in the buffer (if it is not read-only)."
(defun spacemacs/init-volatile-highlights () (defun spacemacs/init-volatile-highlights ()
(use-package volatile-highlights (use-package volatile-highlights
:init :init
(progn (progn
(volatile-highlights-mode t) (volatile-highlights-mode t)
(spacemacs//hide-lighter volatile-highlights-mode)))) (spacemacs//hide-lighter volatile-highlights-mode))))