+ (defface sd/buffer-modified-active1 '((t (:background "red" :foreground "black" :inherit mode-line)))
+ "My Powerline face 1 based on powerline-active1."
+ :group 'powerline)
+
+ (defface sd/buffer-view-active1 '((t (:background "green" :foreground "black" :inherit mode-line)))
+ "My Powerline face 1 based on powerline-active1."
+ :group 'powerline)
+
+ (defface sd/mode-line-buffer-id
+ '((t (:background "yellow" :foreground "black" :inherit mode-line-buffer-id)))
+ "My powerline mode-line face, based on mode-line-buffer-id"
+ :group 'powerline)
+
+ ;; Don't show buffer modified for scratch and eshell mode
+ (defun sd/buffer-is-eshel-or-scratch ()
+ "Dot not show modified indicator for buffers"
+ (interactive)
+ (unless (or (string-match "*scratch*" (buffer-name))
+ (equal major-mode 'eshell-mode))
+ t))
+
+ (defun sd/powerline-center-theme_revised ()
+ "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 'sd/mode-line-buffer-id 'mode-line-buffer-id-inactive))
+ (mode-line (if active 'mode-line 'mode-line-inactive))
+ (my-face1 (if active 'sd/powerline-active1 'powerline-inactive1))
+ (my-face-buffer-modified (if (and (sd/buffer-is-eshel-or-scratch) (buffer-modified-p) (not buffer-read-only))
+ 'sd/buffer-modified-active1
+ (if buffer-read-only 'sd/buffer-view-active1
+ my-face1)))
+ (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 "%* " my-face-buffer-modified 'l)
+ ;; (powerline-buffer-size mode-line 'l)
+ (powerline-buffer-id mode-line-buffer-id 'l)
+ (powerline-raw " " my-face1)
+ (funcall separator-left my-face1 face1)
+ (powerline-narrow face1 'l)
+ ;; (powerline-vc face1)
+ (sd/powerline-simpler-vc (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 my-face1)
+ ;; (powerline-raw " " my-face1)
+ (powerline-raw (format-time-string " %I:%M %p ") my-face1 'r)
+ ;; (powerline-raw "%6p" my-face1 'r)
+ ;; (powerline-hud my-face1 face1 )
+ ))
+ (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)))))))
+
+ (sd/powerline-center-theme_revised)
+#+END_SRC
+
+Fix the issue in mode line when showing triangle
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq ns-use-srgb-colorspace nil)
+#+END_SRC
+
+set height in mode line
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (with-eval-after-load "powerline"
+ (if window-system
+ (progn
+ (let* ((base-font-size (face-attribute 'default :height)))
+ ;; 100/140;0.8
+ (set-variable 'powerline-height (/ base-font-size 10))
+ (set-variable 'powerline-text-scale-factor (/ (float 100) base-font-size)))
+ (set-face-attribute 'mode-line nil :height 100)
+ (set-face-attribute 'mode-line-inactive nil :height 100))))
+#+END_SRC
+
+* IDO & SMEX
+** IDO
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package ido
+ :ensure t
+ :init (setq ido-enable-flex-matching nil
+ ido-ignore-extensions t
+ ido-use-virtual-buffers t
+ ido-everywhere t)
+ (setq ido-save-directory-list-file (concat sd-temp-directory "ido.last"))
+ :config
+ (ido-mode 1)
+ (ido-everywhere 1)
+ (add-to-list 'completion-ignored-extensions ".pyc"))
+
+ (icomplete-mode t)
+#+END_SRC
+
+** FLX
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package flx-ido
+ :ensure t
+ :init (setq ido-enable-flex-matching nil
+ ido-use-faces nil)
+ :config (flx-ido-mode nil))
+#+END_SRC
+
+** IDO-vertically
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package ido-vertical-mode
+ :ensure t
+ :init
+ (setq ido-vertical-define-keys 'C-n-C-p-up-and-down)
+ :config
+ (ido-vertical-mode 1))
+#+END_SRC
+
+** SMEX
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package smex
+ :ensure t
+ :init
+ (setq smex-save-file (concat sd-temp-directory "smex-items"))
+ (smex-initialize)
+ :bind
+ ("M-x" . smex)
+ ("M-X" . smex-major-mode-commands))
+#+END_SRC
+
+** Ido-ubiquitous
+Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for ido everywhere. It makes =describe-function= can also use ido
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package ido-ubiquitous
+ :ensure t
+ :init
+ (setq magit-completing-read-function 'magit-ido-completing-read)
+ (setq gnus-completing-read-function 'gnus-ido-completing-read)
+ :config
+ (ido-ubiquitous-mode 1))
+#+END_SRC
+
+** Ido-exit-target
+[[https://github.com/waymondo/ido-exit-target][ido-exit-target]] let you open file/buffer on =other-windows= when call =ido-switch-buffer=
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package ido-exit-target
+ :ensure t
+ :init
+ (mapcar #'(lambda (map)
+ (define-key map (kbd "C-j") #'ido-exit-target-other-window)
+ (define-key map (kbd "C-k") #'ido-exit-target-split-window-below))
+ (list ido-buffer-completion-map
+ ;; ido-common-completion-map
+ ido-file-completion-map
+ ido-file-dir-completion-map)))
+#+END_SRC
+
+** Counsel
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package counsel
+ :ensure t
+ :defer t
+ :init
+ (global-set-key (kbd "M-x") 'counsel-M-x)
+ (global-set-key (kbd "C-h f") 'counsel-describe-function)
+ (global-set-key (kbd "C-h v") 'counsel-describe-variable)
+ ;; (set-face-attribute 'ivy-current-match nil :background "Orange" :foreground "black")
+ (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
+ (global-set-key (kbd "C-c C-r") 'ivy-resume))
+
+
+
+ ;; (global-set-key "\C-s" 'swiper)
+ ;; (global-set-key (kbd "<f6>") 'ivy-resume)
+ ;; ;; (global-set-key (kbd "C-x C-f") 'counsel-find-file)
+ ;; (global-set-key (kbd "<f1> l") 'counsel-load-library)
+ ;; (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
+ ;; (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
+ ;; (global-set-key (kbd "C-c g") 'counsel-git)
+ ;; (global-set-key (kbd "C-c j") 'counsel-git-grep)
+ ;; (global-set-key (kbd "C-c k") 'counsel-ag)
+ ;; (global-set-key (kbd "C-x l") 'counsel-locate)
+ ;; (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)