X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d_2%2Fconfig.org;h=e1c9f8c5ee82ab5a7e17838d59d40761559222c5;hb=7a61db417646acfebe92d8fe62bce3b0a8733ac9;hp=6c8ff38beba600dabcab0ae49e78488ab389b319;hpb=5a7fa57deaab3ea3e98c9a9c6889db6d6b9bedf9;p=dotfiles.git diff --git a/emacs.d_2/config.org b/emacs.d_2/config.org index 6c8ff38..e1c9f8c 100644 --- a/emacs.d_2/config.org +++ b/emacs.d_2/config.org @@ -10,6 +10,18 @@ Most config are just copied from [[https://github.com/howardabrams/dot-files][ho ** Setting loading Path +Set system PATH and emacs exec path + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (setenv "PATH" (concat (getenv "PATH") + ":" "/usr/local/bin" + ":" "/Library/TeX/texbin")) + (setq exec-path (append exec-path '("/usr/local/bin"))) + (setq exec-path (append exec-path '("/Library/TeX/texbin/"))) + +#+END_SRC + Set the emacs load path #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -20,16 +32,17 @@ Set the emacs load path ** Package Initialization -#+BEGIN_SRC emacs-lisp :tangle yes +#+BEGIN_SRC emacs-lisp :tangle yes :results silent (require 'package) (setq package-archives '(("mepla" . "http://melpa.milkbox.net/packages/") + ("gnu" . "http://elpa.gnu.org/packages/") ("org" . "http://orgmode.org/elpa/"))) (package-initialize) -#+END_SRC +#+END_SRC ** General Setting @@ -335,6 +348,92 @@ cause we cannot input =[= and =]=, so here I unset this mappings. And redifined ** Capture +** 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 * Magit [[https://github.com/magit/magit][Magit]] is a very cool git interface on Emacs. @@ -423,7 +522,28 @@ Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for #+END_SRC -* File and Buffer Operation +** 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 + (define-key ido-common-completion-map (kbd "C-j") #'ido-exit-target-other-window)) + +#+END_SRC + +* Key bindings + +** Remove prefix =ESC=, refer [[http://emacs.stackexchange.com/questions/14755/how-to-remove-bindings-to-the-esc-prefix-key][here]] + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + ;; (define-key key-translation-map (kbd "ESC") (kbd "C-g")) + +#+END_SRC ** Esc on Minibuffer @@ -446,6 +566,7 @@ Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g= #+END_SRC + ** =Super= bindings for file, buffer and windows Some global bindings on =Super=, on Mac, it is =Command= @@ -455,6 +576,11 @@ Some global bindings on =Super=, on Mac, it is =Command= (global-set-key (kbd "s-h") 'keyboard-quit) (global-set-key (kbd "s-j") 'ido-switch-buffer) ;; s-k --> kill-this-buffer + (global-set-key (kbd "s-k") (lambda () + (interactive) + (if (> (length (window-list)) 1) + (delete-window) + (message "Only one Windows now!")))) ;; s-l --> goto-line ;; s-; --> ;; s-' --> 'next-multiframe-window @@ -537,11 +663,17 @@ I use the prefix =M-s= for searching in buffers (global-set-key key keymap)) (global-set-key (kbd "M-s M-s") 'isearch-forward-regexp) - (global-set-key (kbd "M-s M-r") 'isearch-forward-regexp) + (global-set-key (kbd "M-s M-r") 'isearch-backward-regexp) + + (define-key isearch-mode-map "\M-s" 'isearch-repeat-forward) + (define-key isearch-mode-map "\M-r" 'isearch-repeat-backward) - (define-key isearch-mode-map (kbd "M-s") 'isearch-forward-regexp) + ;; (global-set-key (kbd "M-s M-r") 'isearch-backward-regexp) #+END_SRC + + + * Misc Settings @@ -631,7 +763,9 @@ Refer [[https://github.com/abo-abo/hydra/blob/master/hydra-examples.el][hydra-ex (split-window-below) (windmove-down)) "horz") - ("o" delete-other-windows "one" :exit t) + ;; ("o" delete-other-windows "one" :exit t) + ;; Todo define o to triggle delete others windows and restore windows layout + ("o" triggle-windows-max-size "maximize" :exit t) ("a" ace-window "ace") ("s" ace-swap-window "swap") ("d" ace-delete-window "ace-one" :exit t) @@ -646,6 +780,12 @@ Refer [[https://github.com/abo-abo/hydra/blob/master/hydra-examples.el][hydra-ex (global-unset-key (kbd "M-o")) (global-set-key (kbd "M-o") 'sd/hydra-window/body) + (defun triggle-windows-max-size () + (interactive) + (if (> (length (window-list)) 1) + (delete-other-windows) + (winner-undo))) + #+END_SRC ** Line Number @@ -785,7 +925,67 @@ Type =o= to go to the link (:map projectile-mode-map ("s-p" . projectile-persp-switch-project))) + ;; projectile-find-file + ;; projectile-switch-buffer + ;; projectile-find-file-other-window +#+END_SRC + +** Which key + +[[https://github.com/justbur/emacs-which-key][which-key]] show the key bindings + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package which-key + :ensure t + :config + (which-key-mode)) + #+END_SRC + +** Emms + +We can use [[https://www.gnu.org/software/emms/quickstart.html][Emms]] for multimedia in Emacs + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package emms + :ensure t + :init + (setq emms-source-file-default-directory "~/Music/emms/") + :config + (emms-standard) + (emms-default-players) + (define-emms-simple-player mplayer '(file url) + (regexp-opt '(".ogg" ".mp3" ".mgp" ".wav" ".wmv" ".wma" ".ape" + ".mov" ".avi" ".ogm" ".asf" ".mkv" ".divx" ".mpeg" + "http://" "mms://" ".rm" ".rmvb" ".mp4" ".flac" ".vob" + ".m4a" ".flv" ".ogv" ".pls")) + "mplayer" "-slave" "-quiet" "-really-quiet" "-fullscreen") + (emms-history-load)) + +#+END_SRC + +** GnoGo + +Play Go in Emacs, gnugo xpm refert [[https://github.com/okanotor/dotemacs/blob/f95b774cb292d1169748bc0a62ba647bbd8c0652/etc/my-inits/my-inits-gnugo.el][to here]]. start at image display mode and grid mode + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package gnugo + :ensure t + :defer t + :init + (require 'gnugo-imgen) + (setq gnugo-xpms 'gnugo-imgen-create-xpms) + (add-hook 'gnugo-start-game-hook '(lambda () + (gnugo-image-display-mode) + (gnugo-grid-mode))) + :config + (add-to-list 'gnugo-option-history (format "--boardsize 19 --color black --level 1"))) + +#+END_SRC + * Programming ** Languages