+* Ediff
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (with-eval-after-load 'ediff
+ (setq ediff-split-window-function 'split-window-horizontally)
+ (setq ediff-window-setup-function 'ediff-setup-windows-plain)
+ (add-hook 'ediff-startup-hook 'ediff-toggle-wide-display)
+ (add-hook 'ediff-cleanup-hook 'ediff-toggle-wide-display)
+ (add-hook 'ediff-suspend-hook 'ediff-toggle-wide-display))
+#+END_SRC
+
+* TODO Convert ASCII to key
+** map =function-key-map= [[http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm][ascii_ctrl]]
+new file =C-x C-f C-f=
+
+** write color syntax for =Man-mode=
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (font-lock-add-keywords 'perl-mode '(("\\(|\\w+?\\(,\\w+?\\)?|\\)" 1 'py-builtins-face)))
+#+END_SRC
+
+* TODO set fly-spell binding
+
+* TODO imenu bindings
+
+* DONE modified indicator
+:LOGBOOK:
+- State "DONE" from "TODO" [2016-07-18 Mon 23:35]
+:END:
+* DONE highlight selected ido candicate
+:LOGBOOK:
+- State "DONE" from "TODO" [2016-07-19 Tue 01:49]
+:END:
+* DONE show time in right of mode-line
+:LOGBOOK:
+- State "DONE" from "TODO" [2016-07-19 Tue 01:11]
+:END:
+* DONE ediff mode
+:LOGBOOK:
+- State "DONE" from "TODO" [2016-07-19 Tue 01:11]
+:END:
+* TODO jump last change point
+* TODO emms mode-line
+
+* NEXT Key Bindings
+Here are some global key bindings for basic editting
+** Project operations - =super=
+=projectile= settins
+** Windown & Buffer - =C-o=
+Defind a =hydra= function for windows, buffer & bookmark operations. And map it to =C-o= globally.
+Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to delete other windows
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (winner-mode 1)
+
+ (defhydra sd/hydra-window (:color red :columns nil)
+ "window"
+ ("h" windmove-left nil :exit t)
+ ("j" windmove-down nil :exit t)
+ ("k" windmove-up nil :exit t)
+ ("l" windmove-right nil :exit t)
+ ("H" hydra-move-splitter-left nil)
+ ("J" hydra-move-splitter-down nil)
+ ("K" hydra-move-splitter-up nil)
+ ("L" hydra-move-splitter-right nil)
+ ("v" (lambda ()
+ (interactive)
+ (split-window-right)
+ (windmove-right))
+ "vert" :exit t)
+ ("x" (lambda ()
+ (interactive)
+ (split-window-below)
+ (windmove-down))
+ "horz" :exit t)
+ ("o" delete-other-windows "one" :exit t)
+ ("C-o" ido-switch-buffer "buf" :exit t)
+ ("C-k" sd/delete-current-window "del" :exit t)
+ ("'" other-window "other" :exit t)
+ ("a" ace-window "ace")
+ ("s" ace-swap-window "swap")
+ ("d" ace-delete-window "ace-one" :exit t)
+ ("i" ace-maximize-window "ace-one" :exit t)
+ ("b" ido-switch-buffer "buf" :exit t)
+ ("C-b" ido-switch-buffer "buf" :exit t)
+ ("m" bookmark-jump-other-window "open bmk" :exit t)
+ ("M" bookmark-set "set bmk" :exit t)
+ ("q" nil "cancel")
+ ("u" (progn (winner-undo) (setq this-command 'winner-undo)) "undo")
+ ("r" (progn (winner-redo) (setq this-command 'winner-redo)) "redo")
+ ("C-h" nil nil :exit t)
+ ("C-j" nil nil :exit t)
+ ;; ("C-k" nil :exit t)
+ ("C-l" nil nil :exit t)
+ ("C-;" nil nil :exit t)
+ ("p" nil nil :exit t)
+ ("n" nil nil :exit t)
+ ("[" nil nil :exit t)
+ ("]" nil nil :exit t)
+ ("f" nil))
+
+ (global-unset-key (kbd "C-o"))
+ (global-set-key (kbd "C-o") 'sd/hydra-window/body)
+#+END_SRC
+
+** Edit
+- cut, yank, =C-w=, =C-y=
+- save, revert
+- undo, redo - undo-tree
+- select, expand-region
+- spell check, flyspell
+
+** Motion
+- =C-M-=
+*** Use =Avy= for motion
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package avy
+ :ensure t
+ :config
+ (avy-setup-default))
+
+ (global-set-key (kbd "C-M-j") 'avy-goto-line-below)
+ (global-set-key (kbd "C-M-n") 'avy-goto-line-below)
+ (global-set-key (kbd "C-M-k") 'avy-goto-line-above)
+ (global-set-key (kbd "C-M-p") 'avy-goto-line-above)
+
+ (global-set-key (kbd "C-M-f") 'avy-goto-word-1-below)
+ (global-set-key (kbd "C-M-b") 'avy-goto-word-1-above)
+
+ ;; (global-set-key (kbd "M-g e") 'avy-goto-word-0)
+ (global-set-key (kbd "C-M-w") 'avy-goto-char-timer)
+ (global-set-key (kbd "C-M-l") 'avy-goto-char-in-line)
+
+ ;; will delete above
+ (global-set-key (kbd "M-g j") 'avy-goto-line-below)
+ (global-set-key (kbd "M-g k") 'avy-goto-line-above)
+ (global-set-key (kbd "M-g w") 'avy-goto-word-1-below)
+ (global-set-key (kbd "M-g b") 'avy-goto-word-1-above)
+ (global-set-key (kbd "M-g e") 'avy-goto-word-0)
+ (global-set-key (kbd "M-g f") 'avy-goto-char-timer)
+ (global-set-key (kbd "M-g c") 'avy-goto-char-in-line)
+
+ ;; M-g TAB move-to-column
+ ;; M-g ESC Prefix Command
+ ;; M-g c goto-char
+ ;; M-g g goto-line
+ ;; M-g n next-error
+ ;; M-g p previous-error
+
+ ;; M-g M-g goto-line
+ ;; M-g M-n next-error
+ ;; M-g M-p previous-error
+#+END_SRC
+
+*** =imenu=
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; (global-unset-key (kbd "C-M-i"))
+ ;; (global-set-key (kbd "C-M-i") #'counsel-imenu)
+ (global-set-key (kbd "M-i") #'counsel-imenu)
+
+ (global-set-key (kbd "M-l") 'goto-line)
+#+END_SRC
+
+*** Movement effective
+[[https://www.masteringemacs.org/article/effective-editing-movement][effective-editing-movement]]
+**** Command arguments, numeric argument
+=C-u 4= same as =C-4=, =M-4=
+**** movement by word
+=M-b=, =M-f=
+**** movement by paragraph/sentence
+=M-e=, =M-a=
+**** scrolling
+=C-v=, =M-v=
+**** Move to begin/end buffer
+=M->=, =M-<=
+**** Advanced movement
+***** movement by s-expression
+***** isearch
+=C-s=, =C-r=
+=C-w=, put the word into search minibuffer, =M-y=
+=M-c=, toggle case sensitivity
+=M-n=, =M-p=, history
+***** back to indentation
+=M-m=
+***** Registers/Bookmarks
+Register, =C-x r SPC=, =C-x r j=
+Bookmarks, =C-x r m=, =C-x r b=, =C-x r l=
+***** Mark
+Stolen [[https://www.masteringemacs.org/article/fixing-mark-commands-transient-mark-mode][fixing-mark-commands-transient-mark-mode]]
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (defun push-mark-no-activate ()
+ "Pushes `point' to `mark-ring' and does not activate the region
+ Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
+ (interactive)
+ (push-mark (point) t nil)
+ (message "Pushed mark to ring"))
+
+ (global-set-key (kbd "C-`") 'push-mark-no-activate)
+
+ (defun jump-to-mark ()
+ "Jumps to the local mark, respecting the `mark-ring' order.
+ This is the same as using \\[set-mark-command] with the prefix argument."
+ (interactive)
+ (set-mark-command 1))
+
+ (global-set-key (kbd "M-`") 'jump-to-mark)
+
+ (defun exchange-point-and-mark-no-activate ()
+ "Identical to \\[exchange-point-and-mark] but will not activate the region."
+ (interactive)
+ (exchange-point-and-mark)
+ (deactivate-mark nil))
+
+ (define-key global-map [remap exchange-point-and-mark] 'exchange-point-and-mark-no-activate)
+#+END_SRC
+***** Repositioning Point
+=M-r=
+***** Imenu
+ido-goto-symbol
+***** tagss
+***** got-to-line
+***** Next/Prev error
+***** begin/end of defun
+** Search & Replace / hightlight =M-s=
+*** search
+*** replace
+*** hightlight
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+
+ ;; (defhydra sd/search-highlight (:color red :columns nil)
+ ;; "search"
+ ;; ("M-s" . isearch-forward-regexp "search-forward" :exit t)
+ ;; ("s" . isearch-forward-regexp "search-forward" :exit t)
+ ;; ("r" . isearch-backward-regexp "search-backward" :exit t)
+ ;; )
+
+ ;; (setq-default indicate-empty-lines t)
+#+END_SRC
+
+*** Occur
+Occur search key bindings
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (defun sd/occur-keys ()
+ "My key bindings in occur-mode"
+ (interactive)
+ (switch-to-buffer-other-window "*Occur*")
+ (define-key occur-mode-map (kbd "C-o") nil)
+ (define-key occur-mode-map (kbd "C-n") (lambda ()
+ (interactive)
+ (occur-next)
+ (occur-mode-goto-occurrence-other-window)
+ (recenter)
+ (other-window 1)))
+ (define-key occur-mode-map (kbd "C-p") (lambda ()
+ (interactive)
+ (occur-prev)
+ (occur-mode-goto-occurrence-other-window)
+ (recenter)
+ (other-window 1))))
+
+ (add-hook 'occur-hook #'sd/occur-keys)
+
+ (use-package color-moccur
+ :ensure t
+ :commands (isearch-moccur isearch-all)
+ :init
+ (setq isearch-lazy-highlight t)
+ :config
+ (use-package moccur-edit))
+#+END_SRC
+
+*** Swiper
+stolen from [[https://github.com/mariolong/emacs.d/blob/f6a061594ef1b5d1f4750e9dad9dc97d6e122840/emacs-init.org][here]]
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package swiper
+ :ensure t
+ :init
+ (setq ivy-use-virtual-buffers t)
+ (set-face-attribute 'ivy-current-match nil :background "Orange" :foreground "black")
+ :config
+ (ivy-mode)
+ (global-set-key (kbd "s-/") 'swiper)
+ (define-key swiper-map (kbd "M-r") 'swiper-query-replace)
+ (define-key swiper-map (kbd "C-.") (lambda ()
+ (interactive)
+ (insert (format "%s" (with-ivy-window (thing-at-point 'word))))))
+ (define-key swiper-map (kbd "M-.") (lambda ()
+ (interactive)
+ (insert (format "%s" (with-ivy-window (thing-at-point 'symbol)))))))
+#+END_SRC
+
+* TODO Temp directory for cached/history/temp files
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package recentf
+ :config
+ (setq recentf-save-file (concat sd-temp-directory "recentf")))
+
+ (use-package projectile
+ :config
+ (setq projectile-cache-file (concat sd-temp-directory "projectile.cache")))
+
+ (use-package ido
+ :config
+ (setq ido-save-directory-list-file (concat sd-temp-directory "ido.last")))