-* Normal Text Operation
-** Edit
-*** undo-tree
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (use-package undo-tree
- :ensure t
- :config
- (define-key undo-tree-visualizer-mode-map "j" 'undo-tree-visualize-redo)
- (define-key undo-tree-visualizer-mode-map "k" 'undo-tree-visualize-undo)
- (define-key undo-tree-visualizer-mode-map "h" 'undo-tree-visualize-switch-branch-left)
- (define-key undo-tree-visualizer-mode-map "l" 'undo-tree-visualize-switch-branch-right)
- (global-undo-tree-mode 1))
-
- (global-set-key (kbd "s-u") 'undo-tree-visualize)
-#+END_SRC
-
-*** flyspell
-Stolen from [[https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-spelling.el][here]], hunspell will search dictionary in =DICPATH=
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (setenv "DICPATH" "/usr/local/share/hunspell")
-
- (when (executable-find "hunspell")
- (setq-default ispell-program-name "hunspell")
- (setq ispell-really-hunspell t))
-
- ;; (defun text-mode-hook-setup ()
- ;; ;; Turn off RUN-TOGETHER option when spell check text-mode
- ;; (setq-local ispell-extra-args (flyspell-detect-ispell-args)))
- ;; (add-hook 'text-mode-hook 'text-mode-hook-setup)
- ;; (add-hook 'text-mode-hook 'flyspell-mode)
-
- ;; enable flyspell check on comments and strings in progmamming modes
- ;; (add-hook 'prog-mode-hook 'flyspell-prog-mode)
-
- ;; I don't use the default mappings
- (with-eval-after-load 'flyspell
- (define-key flyspell-mode-map (kbd "C-;") nil)
- (define-key flyspell-mode-map (kbd "C-,") nil)
- (define-key flyspell-mode-map (kbd "C-.") nil))
-#+END_SRC
-
-Make flyspell enabled for org-mode, see [[http://emacs.stackexchange.com/questions/9333/how-does-one-use-flyspell-in-org-buffers-without-flyspell-triggering-on-tangled][here]]
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- ;; NO spell check for embedded snippets
- (defadvice org-mode-flyspell-verify (after org-mode-flyspell-verify-hack activate)
- (let ((rlt ad-return-value)
- (begin-regexp "^[ \t]*#\\+begin_\\(src\\|html\\|latex\\)")
- (end-regexp "^[ \t]*#\\+end_\\(src\\|html\\|latex\\)")
- old-flag
- b e)
- (when ad-return-value
- (save-excursion
- (setq old-flag case-fold-search)
- (setq case-fold-search t)
- (setq b (re-search-backward begin-regexp nil t))
- (if b (setq e (re-search-forward end-regexp nil t)))
- (setq case-fold-search old-flag))
- (if (and b e (< (point) e)) (setq rlt nil)))
- (setq ad-return-value rlt)))
-#+END_SRC
-
-*** Expand-region
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (use-package expand-region
- :ensure t
- :config
- (global-set-key (kbd "C-=") 'er/expand-region))
-#+END_SRC
-
-* Key bindings
-
-** Esc on Minibuffer
-
-Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g=
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
-
- (define-key minibuffer-local-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-ns-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-isearch-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-completion-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-must-match-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-must-match-filename-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-filename-completion-map [escape] 'keyboard-escape-quit)
- (define-key minibuffer-local-filename-must-match-map [escape] 'keyboard-escape-quit)
-
- ;; Also map s-h same as C-g
- (define-key minibuffer-local-map (kbd "s-h") 'keyboard-escape-quit)
-
-#+END_SRC
-
-** Search Replace and highlight
-*** swiper