-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (defun sd/delete-current-window ()
- (interactive)
- (if (> (length (window-list)) 1)
- (delete-window)
- (message "Only one Windows now!")))
-
- ;; (global-set-key (kbd "s-h") 'keyboard-quit)
- ;; (global-set-key (kbd "s-j") 'ido-switch-buffer)
- ;; (global-set-key (kbd "s-k") 'ido-find-file)
- ;; (global-set-key (kbd "s-l") 'sd/delete-current-window)
- ;; s-l --> goto-line
- ;; (global-set-key (kbd "s-/") 'swiper)
- ;; s-; -->
- ;; s-' --> 'next-multiframe-window
- (global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
-
- (global-set-key (kbd "s-f") 'projectile-find-file)
-
- (global-set-key (kbd "s-`") 'mode-line-other-buffer)
-
- (global-set-key (kbd "s-n") 'persp-next)
- (global-set-key (kbd "s-p") 'persp-prev)
-
- (global-set-key (kbd "s-=") 'text-scale-increase)
- (global-set-key (kbd "s--") 'text-scale-decrease)
-
- ;; (global-set-key (kbd "s-u") 'undo-tree-visualize)
-
-
- ;; someothers default mapping on super (command) key
- ;; s-s save-buffer
- ;; s-k kill-this-buffer
-
-
- ;; s-h --> ns-do-hide-emacs
- ;; s-j --> ido-switch-buffer +
- ;; s-k --> kill-this-buffer
- ;; s-l --> goto-line
- ;; s-; --> undefined
- ;; s-' --> next-multiframe-window
- ;; s-ret --> toggle-frame-fullscreen +
-
- ;; s-y --> ns-paste-secondary
- ;; s-u --> revert-buffer
- ;; s-i --> undefined - but used for iterm globally
- ;; s-o --> used for emacs globally
- ;; s-p --> projectile-persp-switch-project +
- ;; s-[ --> next-buffer +
- ;; s-] --> previous-buffer +
-
- ;; s-0 --> undefined
- ;; s-9 --> undefined
- ;; s-8 --> undefined
- ;; s-7 --> undefined
- ;; s-6 --> undefined
- ;; s-- --> center-line
- ;; s-= --> undefined
-
- ;; s-n --> make-frame
- ;; s-m --> iconify-frame
- ;; s-b --> undefined
- ;; s-, --> customize
- ;; s-. --> undefined
- ;; s-/ --> undefined
-
- ;; s-g --> isearch-repeat-forward
- ;; s-f --> projectile-find-file +
- ;; s-d --> isearch-repeat-background
- ;; s-s --> save-buffer
- ;; s-a --> make-whole-buffer
-
- ;; s-b --> undefined
- ;; s-v --> yank
- ;; s-c --> ns-copy-including-secondary
-
- ;; s-t --> ns-popup-font-panel
- ;; s-r --> undefined
- ;; s-e --> isearch-yanqk-kill
- ;; s-w --> delete-frame
- ;; s-q --> same-buffers-kill-emacs
-
- ;; s-` --> other-frame
-#+END_SRC
-
-** Search Replace and highlight
-*** swiper
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- ;; (use-package swiper
- ;; :ensure t)
-
- ;; (ivy-mode 1)
- ;; (setq ivy-use-virtual-buffers t)
- ;; (global-set-key (kbd "s-/") 'swiper)
-
- (use-package counsel
- :ensure t
- :defer t)
- ;;*
- ;; (global-set-key "\C-s" 'swiper)
- ;; (global-set-key (kbd "C-c C-r") 'ivy-resume)
- ;; (global-set-key (kbd "<f6>") 'ivy-resume)
- (global-set-key (kbd "M-x") 'counsel-M-x)
- ;; ;; (global-set-key (kbd "C-x C-f") 'counsel-find-file)
- (global-set-key (kbd "C-h f") 'counsel-describe-function)
- (global-set-key (kbd "C-h v") 'counsel-describe-variable)
- ;; (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)
- ;; ;; (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
-
- ;; (set-face-attribute
- ;; 'ivy-current-match nil
- ;; :background "Orange"
- ;; :foreground "black")
-
- ;; ivy-resume
- ;; (define-key swiper-map (kbd "M-%") 'swiper-aa-replace)
-#+END_SRC
-
-*** =M-s= prefix
-use the prefix =M-s= for searching in buffers
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (defun sd/make-keymap (key bindings)
- (setq keymap (make-sparse-keymap))
- (dolist (binding bindings)
- (define-key keymap (car binding) (cdr binding)))
- (global-set-key key keymap))
-
- (use-package highlight-symbol
- :ensure t)
-
- (sd/make-keymap "\M-s"
- '(("w" . save-buffer)
- ;; ("\M-w" . save-buffer)
- ("e" . revert-buffer)
- ("s" . isearch-forward-regexp)
- ("\M-s" . isearch-forward-regexp)
- ("r" . isearch-backward-regexp)
- ("." . isearch-forward-symbol-at-point)
- ("o" . occur)
- ;; ("h" . highlight-symbol-at-point)
- ("h" . highlight-symbol)
- ("m" . highlight-regexp)
- ("l" . highlight-lines-matching-regexp)
- ("M" . unhighlight-regexp)
- ("f" . keyboard-quit)
- ("q" . keyboard-quit)))
-
- ;; search and replace and highlight
- (define-key isearch-mode-map (kbd "M-s") 'isearch-repeat-forward)
- (define-key isearch-mode-map (kbd "M-r") 'isearch-repeat-backward)
- (global-set-key (kbd "s-[") 'highlight-symbol-next)
- (global-set-key (kbd "s-]") 'highlight-symbol-prev)
- (global-set-key (kbd "s-\\") 'highlight-symbol-query-replace)
-
-
- (define-key minibuffer-local-map "\M-s" nil)
-
- (set-face-background 'ido-first-match "yellow")
-
- ;; M-s M-w eww-search-words
-
- ;; M-c
- ;; M-r
- ;; M-t
- ;; M-u,
-#+END_SRC
-
-* Org-mode Settings
-
-** Org-mode Basic setting
-
-Always indents header, and hide header leading starts so that no need type =#+STATUP: indent=
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (use-package org
- :ensure t
- :init
- (setq org-startup-indented t)
- (setq org-hide-leading-starts t)
- (setq org-src-fontify-natively t)
- (setq org-src-tab-acts-natively t)
- (setq org-confirm-babel-evaluate nil)
- (setq org-use-speed-commands t)
- (setq org-completion-use-ido t))
-
- (org-babel-do-load-languages
- 'org-babel-load-languages
- '((python . t)
- (C . t)
- (perl . t)
- (calc . t)
- (latex . t)
- (java . t)
- (ruby . t)
- (lisp . t)
- (scheme . t)
- (sh . t)
- (sqlite . t)
- (js . t)
- (gnuplot . t)
- (ditaa . t)))
-
- ;; use current window for org source buffer editting
- (setq org-src-window-setup 'current-window )
-
- (define-key org-mode-map (kbd "C-'") nil)
- ;; C-M-i is mapped to imenu globally
- (define-key org-mode-map (kbd "C-M-i") nil)
-
- ;; set the ditta.jar path
- (setq org-ditaa-jar-path "/usr/local/Cellar/ditaa/0.9/libexec/ditaa0_9.jar")
- (unless
- (file-exists-p org-ditaa-jar-path)
- (error "seudut: ditaa.jar not found at %s " org-ditaa-jar-path))
-#+END_SRC
-
-** Org-bullets
-
-use [[https://github.com/sabof/org-bullets][org-bullets]] package to show utf-8 charactes
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (use-package org-bullets
- :ensure t
- :init
- (add-hook 'org-mode-hook
- (lambda ()
- (org-bullets-mode t))))
-
- (setq org-bullets-bullet-list '("⦿" "✪" "◉" "○" "►" "◆"))
-
- ;; increase font size when enter org-src-mode
- (add-hook 'org-src-mode-hook (lambda () (text-scale-increase 2)))
-#+END_SRC
-
-** Worf Mode
-
-[[https://github.com/abo-abo/worf][worf]] mode is an extension of vi-like binding for org-mode.
-In =worf-mode=, it is mapping =[=, =]= as =worf-backward= and =worf-forward= in global, wich
-cause we cannot input =[= and =]=, so here I unset this mappings. And redifined this two to
-=M-[= and =M-]=. see this [[https://github.com/abo-abo/worf/issues/19#issuecomment-223756599][issue]]
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
-
- (use-package worf
- :ensure t
- :commands worf-mode
- :init (add-hook 'org-mode-hook 'worf-mode)
- ;; :config
- ;; (define-key worf-mode-map "[" nil)
- ;; (define-key worf-mode-map "]" nil)
- ;; (define-key worf-mode-map (kbd "M-[") 'worf-backward)
- ;; (define-key worf-mode-map (kbd "M-]") 'worf-forward)
- )
-
-#+END_SRC
-
-** Get Things Done
-
-Refer to [[http://doc.norang.ca/org-mode.html][Organize Your Life in Plain Text]]
-*** basic setup
-
-standard key binding
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (global-set-key "\C-cl" 'org-store-link)
- (global-set-key "\C-ca" 'org-agenda)
- (global-set-key "\C-cb" 'org-iswitchb)
-#+END_SRC
-
-*** Plain List
-
-Replace the list bullet =-=, =+=, with =•=, a litter change based [[https://github.com/howardabrams/dot-files/blob/master/emacs-org.org][here]]
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- ;; (use-package org-mode
- ;; :init
- ;; (font-lock-add-keywords 'org-mode
- ;; '(("^ *\\([-+]\\) "
- ;; (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
-#+END_SRC
-
-*** Todo Keywords
-
-refer to [[http://coldnew.github.io/coldnew-emacs/#orgheadline94][fancy todo states]],
-
-To track TODO state changes, the =!= is to insert a timetamp, =@= is to insert a note with
-timestamp for the state change.
-
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- ;; (setq org-todo-keywords
- ;; '((sequence "☛ TODO(t)" "|" "✔ DONE(d)")
- ;; (sequence "⚑ WAITING(w)" "|")
- ;; (sequence "|" "✘ CANCELLED(c)")))
- ; (setq org-todo-keyword-faces
- ; (quote ("TODO" . (:foreground "red" :weight bold))
- ; ("NEXT" . (:foreground "blue" :weight bold))
- ; ("WAITING" . (:foreground "forest green" :weight bold))
- ; ("DONE" . (:foreground "magenta" :weight bold))
- ; ("CANCELLED" . (:foreground "forest green" :weight bold))))
-
-
- (setq org-todo-keywords
- (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
- ;; (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING")
- (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" ))))