+ (setq org-refile-use-outline-path t)
+
+ (setq org-refile-allow-creating-parent-nodes (quote confirm))
+#+END_SRC
+
+*** Agenda Setup
+Setting agenda files and the agenda view
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-agenda-files (quote ("~/org/gtd.org"
+ "~/org/work.org")))
+
+ ;; only show today's tasks in agenda view
+ (setq org-agenda-span 'day)
+ ;; Use current windows for agenda view
+ (setq org-agenda-window-setup 'current-window)
+
+ ;; show all feature entries for repeating tasks,
+ ;; this is already setting by default
+ (setq org-agenda-repeating-timestamp-show-all t)
+
+ ;; Show all agenda dates - even if they are empty
+ (setq org-agenda-show-all-dates t)
+#+END_SRC
+
+** Export PDF
+
+Install MacTex-basic and some tex packages
+
+#+BEGIN_SRC bash
+
+ sudo tlmgr update --self
+
+ sudo tlmgr install titlesec framed threeparttable wrapfig multirow enumitem bbding titling tabu mdframed tcolorbox textpos import varwidth needspace tocloft ntheorem environ trimspaces collection-fontsrecommended capt-of
+
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; ;; allow for export=>beamer by placing
+
+ ;; http://emacs-fu.blogspot.com/2011/04/nice-looking-pdfs-with-org-mode-and.html
+ ;; #+LaTeX_CLASS: beamer in org files
+ (unless (boundp 'org-export-latex-classes)
+ (setq org-export-latex-classes nil))
+ (add-to-list 'org-export-latex-classes
+ ;; beamer class, for presentations
+ '("beamer"
+ "\\documentclass[11pt]{beamer}\n
+ \\mode<{{{beamermode}}}>\n
+ \\usetheme{{{{beamertheme}}}}\n
+ \\usecolortheme{{{{beamercolortheme}}}}\n
+ \\beamertemplateballitem\n
+ \\setbeameroption{show notes}
+ \\usepackage[utf8]{inputenc}\n
+ \\usepackage[T1]{fontenc}\n
+ \\usepackage{hyperref}\n
+ \\usepackage{color}
+ \\usepackage{listings}
+ \\lstset{numbers=none,language=[ISO]C++,tabsize=4,
+ frame=single,
+ basicstyle=\\small,
+ showspaces=false,showstringspaces=false,
+ showtabs=false,
+ keywordstyle=\\color{blue}\\bfseries,
+ commentstyle=\\color{red},
+ }\n
+ \\usepackage{verbatim}\n
+ \\institute{{{{beamerinstitute}}}}\n
+ \\subject{{{{beamersubject}}}}\n"
+
+ ("\\section{%s}" . "\\section*{%s}")
+
+ ("\\begin{frame}[fragile]\\frametitle{%s}"
+ "\\end{frame}"
+ "\\begin{frame}[fragile]\\frametitle{%s}"
+ "\\end{frame}")))
+
+ ;; letter class, for formal letters
+
+ (add-to-list 'org-export-latex-classes
+
+ '("letter"
+ "\\documentclass[11pt]{letter}\n
+ \\usepackage[utf8]{inputenc}\n
+ \\usepackage[T1]{fontenc}\n
+ \\usepackage{color}"
+
+ ("\\section{%s}" . "\\section*{%s}")
+ ("\\subsection{%s}" . "\\subsection*{%s}")
+ ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+ ("\\paragraph{%s}" . "\\paragraph*{%s}")
+ ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
+
+
+ (require 'ox-md)
+ (require 'ox-beamer)
+
+ (setq org-latex-pdf-process
+ '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
+ "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
+ "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
+
+ (setq TeX-parse-self t)
+
+ (setq TeX-PDF-mode t)
+ (add-hook 'LaTeX-mode-hook
+ (lambda ()
+ (LaTeX-math-mode)
+ (setq TeX-master t)))
+
+#+END_SRC
+
+** others
+
+extend org-mode's easy templates, refer to [[http://coldnew.github.io/coldnew-emacs/#orgheadline94][Extend org-modes' esay templates]]
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+
+ (add-to-list 'org-structure-template-alist
+ '("E" "#+BEGIN_SRC emacs-lisp :tangle yes :results silent\n?\n#+END_SRC"))
+ (add-to-list 'org-structure-template-alist
+ '("S" "#+BEGIN_SRC sh\n?\n#+END_SRC"))
+ (add-to-list 'org-structure-template-alist
+ '("p" "#+BEGIN_SRC plantuml :file uml.png \n?\n#+END_SRC"))
+
+#+END_SRC
+
+* Magit
+[[https://github.com/magit/magit][Magit]] is a very cool git interface on Emacs.
+and Defined keys, using vi keybindings, Refer abo-abo's setting [[https://github.com/abo-abo/oremacs/blob/c5cafdcebc88afe9e73cc8bd40c49b70675509c7/modes/ora-nextmagit.el][here]]
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package magit
+ :ensure t
+ :init
+ ;; don't ask me to confirm the unsaved change
+ (setq magit-save-repository-buffers nil)
+ :commands magit-status magit-blame
+ :config
+ (dolist (map (list magit-status-mode-map
+ magit-log-mode-map
+ magit-diff-mode-map
+ magit-staged-section-map))
+ (define-key map "j" 'magit-section-forward)
+ (define-key map "k" 'magit-section-backward)
+ (define-key map "D" 'magit-discard)
+ (define-key map "O" 'magit-discard-file)
+ (define-key map "n" nil)
+ (define-key map "p" nil)
+ (define-key map "v" 'recenter-top-bottom)
+ (define-key map "i" 'magit-section-toggle)))
+#+END_SRC
+
+* Eshell
+*** Eshell alias
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (defalias 'e 'find-file)
+ (defalias 'ff 'find-file)
+ (defalias 'ee 'find-files)
+#+END_SRC
+
+*** Eshell erase buffer
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (defun sd/eshell-clear-buffer ()
+ "Clear eshell buffer"