X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Fconfig.org;h=8e6bbe721899908d0da9ca132b86c8110676551b;hb=5c411170a6aebdf4fd123ab90e679b5552620221;hp=528540128061401d7f639ed876f448d66a0321f2;hpb=0e5b840b6bcdf3b43392fc50662602de4ed505ee;p=dotfiles.git diff --git a/emacs.d/config.org b/emacs.d/config.org index 5285401..8e6bbe7 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -8,29 +8,22 @@ Most config are just copied from [[https://github.com/howardabrams/dot-files][ho * Basic Settings ** 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 ;; (add-to-list 'load-path "~/.emacs.d/elisp") #+END_SRC ** Package Initialization - #+BEGIN_SRC emacs-lisp :tangle yes :results silent - (require 'package) (setq package-archives '(("mepla" . "http://melpa.milkbox.net/packages/") @@ -38,7 +31,6 @@ Set the emacs load path ("org" . "http://orgmode.org/elpa/"))) (package-initialize) - #+END_SRC ** General Setting @@ -109,7 +101,6 @@ Make a temp directory for all cache/history files #+END_SRC * Package Management Tools - ** Use-package Using [[https://github.com/jwiegley/use-package][use-package]] to manage emacs packages #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -136,6 +127,17 @@ Check out [[http://tapoueh.org/emacs/el-get.html][el-get]]. :ensure t) #+END_SRC +* Mac Specific +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + ;; (defconst *is-a-mac* (eq system-type 'darwin)) + ;; (setq mouse-wheel-scroll-amount '(1 + ;; ((shift) . 5) + ;; ((control)))) + + + ;; (setq-default indicate-empty-lines t) +#+END_SRC + * Color and Fonts Settings ** highlight current line @@ -337,7 +339,6 @@ Enable rainbow mode in emacs lisp mode #+END_SRC * Mode-line - ** clean mode line clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replacing-modeline-strings][Marstering Emacs]], some greek character see [[http://xahlee.info/math/math_unicode_greek.html][math_unicode_greek]] #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -639,11 +640,8 @@ let helm windows split inside current window #+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 @@ -665,6 +663,7 @@ Always indents header, and hide header leading starts so that no need type =#+ST (latex . t) (java . t) (ruby . t) + (lua . t) (lisp . t) (scheme . t) (sh . t) @@ -685,12 +684,14 @@ Always indents header, and hide header leading starts so that no need type =#+ST (unless (file-exists-p org-ditaa-jar-path) (error "seudut: ditaa.jar not found at %s " org-ditaa-jar-path)) + + ;; Lua support + (use-package ob-lua + :ensure t) #+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 @@ -706,12 +707,10 @@ use [[https://github.com/sabof/org-bullets][org-bullets]] package to show utf-8 #+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 @@ -728,12 +727,9 @@ cause we cannot input =[= and =]=, so here I unset this mappings. And redifined #+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) @@ -741,9 +737,7 @@ standard key binding #+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 @@ -906,6 +900,8 @@ Setting agenda files and the agenda view ** Export PDF Install MacTex-basic [[http://www.tug.org/mactex/morepackages.html][MacTex-basic]] and some tex packages #+BEGIN_SRC sh + wget http://tug.org/cgi-bin/mactex-download/BasicTeX.pkg + 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 @@ -986,19 +982,17 @@ Install MacTex-basic [[http://www.tug.org/mactex/morepackages.html][MacTex-basic #+END_SRC -** others - +** Org structure template 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")) + '("S" "#+BEGIN_SRC sh :results output replace\n?\n#+END_SRC")) (add-to-list 'org-structure-template-alist '("p" "#+BEGIN_SRC plantuml :file uml.png \n?\n#+END_SRC")) - + (add-to-list 'org-structure-template-alist + '("P" "#+BEGIN_SRC perl \n?\n#+END_SRC")) #+END_SRC * Magit @@ -1112,7 +1106,6 @@ Toggle an eshell in split window below, refer [[http://www.howardism.org/Technic (exec-path-from-shell-initialize)) #+END_SRC -** TODO smart display * Misc Settings ** [[https://github.com/abo-abo/hydra][Hydra]] @@ -1252,68 +1245,50 @@ I like [[https://github.com/coldnew/linum-relative][linum-relative]], just like #+END_SRC ** Multi-term - #+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package multi-term :ensure t) - #+END_SRC ** ace-link - [[https://github.com/abo-abo/ace-link][ace-link]] is a package written by [[https://github.com/abo-abo][Oleh Krehel]]. It is convenient to jump to link in help mode, info-mode, etc Type =o= to go to the link - #+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package ace-link :ensure t :init (ace-link-setup-default)) - #+END_SRC ** Smart Parens - #+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package smartparens :ensure t :config (progn (require 'smartparens-config) (add-hook 'prog-mode-hook 'smartparens-mode))) - #+END_SRC ** Ace-Windows - [[https://github.com/abo-abo/ace-window][ace-window]] - #+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package ace-window :ensure t :defer t - ; :init - ; (global-set-key (kbd "M-o") 'ace-window) + ; :init + ; (global-set-key (kbd "M-o") 'ace-window) :config (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))) - #+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 ** View only for some directory @@ -1371,9 +1346,6 @@ When see function by =C-h f=, and visit the source code, I would like the buffer (require 'info+)) #+END_SRC -** TODO bookmark - -** TODO Calendar ** advice info #+BEGIN_SRC emacs-lisp :tangle yes :results silent (defun sd/info-mode () @@ -1395,15 +1367,6 @@ When see function by =C-h f=, and visit the source code, I would like the buffer (sd/delete-current-window)) #+END_SRC -** TODO Man mode -Color for Man-mode - -** TODO UTF8 -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - ;; (set-language-environment "UTF-8") - ;; (set-default-coding-systems 'utf-8) -#+END_SRC - ** Demo It #+BEGIN_SRC emacs-lisp :tangle yes :results silent ;; (el-get-bundle howardabrams/demo-it) @@ -1450,6 +1413,40 @@ Color for Man-mode (define-key pdf-outline-buffer-mode-map (kbd "k") 'previous-line)) #+END_SRC +** help-mode +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (defun sd/help-mode-hook () + "Mapping for help mode" + (define-key help-mode-map "j" 'next-line) + (define-key help-mode-map "k" 'previous-line) + (define-key help-mode-map "h" 'forward-char) + (define-key help-mode-map "l" 'forward-char) + (define-key help-mode-map "H" 'describe-mode) + (define-key help-mode-map "v" 'recenter-top-bottom) + (define-key help-mode-map "i" 'forward-button) + (define-key help-mode-map "I" 'backward-button) + (define-key help-mode-map "o" 'ace-link-help)) + + (add-hook 'help-mode-hook 'sd/help-mode-hook) +#+END_SRC + +** goto-last-change +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package goto-last-change + :ensure t) +#+END_SRC + +** Ag +install =ag=, =the-silver-searcher= by homebrew on mac +#+BEGIN_SRC sh +brew install the-silver-searcher +#+END_SRC + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package ag + :ensure t) +#+END_SRC + * Dired ** Dired bindings =C-o= is defined as a global key for window operation, here unset it in dired mode @@ -1660,6 +1657,12 @@ company mode and company-statistics (company-statistics-mode)) #+END_SRC +* Libs +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package s + :ensure t) +#+END_SRC + * Programming Language ** Emacs Lisp #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -1827,12 +1830,51 @@ irony-company '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup)) #+END_SRC +*** gtags +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package ggtags + :ensure t) + + (add-hook 'c-mode-common-hook + (lambda () + (when (derived-mode-p 'c-mode 'c++-mode 'java-mode) + (ggtags-mode 1)))) + + (require 'cc-mode) + (require 'semantic) + + (global-semanticdb-minor-mode 1) + (global-semantic-idle-scheduler-mode 1) + + (semantic-mode 1) + +#+END_SRC + *** yasnippet #+BEGIN_SRC emacs-lisp :tangle yes :results silent (use-package yasnippet :ensure t) #+END_SRC +*** semantic +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + +#+END_SRC + +*** google C style +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package google-c-style + :ensure t + :config + (add-hook 'c-mode-hook 'google-set-c-style)) +#+END_SRC + +** Lua +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package lua-mode + :ensure t) +#+END_SRC + * Compile Set the environments vairables in compilation mode #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -1862,14 +1904,14 @@ Set the environments vairables in compilation mode ** C++ Auto Insert #+BEGIN_SRC emacs-lisp :tangle yes :results silent (eval-after-load 'autoinsert - '(define-auto-insert '("\\.cpp\\'" . "C++ skeleton") + '(define-auto-insert '("\\.cpp\\|.cc\\'" . "C++ skeleton") '( "Short description:" "/*" "\n * " (file-name-nondirectory (buffer-file-name)) "\n */" > \n \n "#include " \n - "#include \"" + "//#include \"" (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) ".hpp\"" \n \n @@ -1877,7 +1919,7 @@ Set the environments vairables in compilation mode "int main ()" "\n{" \n > _ \n - "return 1;" + "return 0;" "\n}" > \n ))) @@ -1889,16 +1931,21 @@ Set the environments vairables in compilation mode " * " (file-name-nondirectory (buffer-file-name)) "\n" " */" > \n \n "#include " \n - "#include \"" + "//#include \"" (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) ".h\"" \n \n "int main ()\n" "{" \n > _ \n - "return 1;\n" + "return 0;\n" "}" > \n ))) + + (eval-after-load 'autoinsert + '(define-auto-insert '("\\.h\\|.hpp\\'" . "c/c++ header") + '((s-upcase (s-snake-case (file-name-nondirectory buffer-file-name))) + "#ifndef " str n "#define " str "\n\n" _ "\n\n#endif // " str))) #+END_SRC ** Python template @@ -2127,6 +2174,11 @@ See [[https://www.emacswiki.org/emacs/GnusWindowLayout][GnusWindowLayout]] #+END_SRC * Gnu Plot +Install =gnuplot= on Mac +#+BEGIN_SRC sh + brew install gnuplot --with-qt +#+END_SRC + To fix some issue that =toolbar-make-button-list= is void, see the [[https://github.com/bruceravel/gnuplot-mode/issues/31][issue]], here I set some variable as =nil= #+BEGIN_SRC emacs-lisp :tangle yes :results silent (use-package gnuplot @@ -2405,7 +2457,7 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del ;; buffer / windows switch ("o" sd/toggle-max-windows "one" :exit t) ("C-k" sd/delete-current-window "del" :exit t) - ("D" (lambda () + ("C-d" (lambda () (interactive) (kill-buffer) (sd/delete-current-window)) @@ -2868,69 +2920,14 @@ stolen from [[https://github.com/mariolong/emacs.d/blob/f6a061594ef1b5d1f4750e9d #+END_SRC *** TODO make expand-region hydra work with lispy selected - -* 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 jump last change point -* TODO emms mode-line - -* =C-u C-h a= search funtions -=apropos-command= - * key - passion - vision - mission -* M prefix -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - - ;; M-h - mark-paragraph - ;; M-j - new line indent - ;; M-k - kill-sentence - ;; M-l - downcase words ====== goto-line - ;; M-; - comments - ;; M-'- abbrev-prefix-mark ======= - ;; M-RET none ====== - - ;; M-y - yank - ;; M-u - upcase word - ;; M-i - ====== imenu - ;; M-o ====== prefix - ;; M-p - ;; M-[ ===== - ;; M-] ======== - ;; M-\ deleter horizontal space ===== - - ;; M-n - ;; M-m ---- indent - ;; M-, --- mark stack====== = - ;; M-. lisp-goto-symboo, find definitation - - ;; M-a - ;; M-s ===== - ;; M-d - ;; M-f - ;; M-g - prefix - - ;; M-q - lisp fill, fill paragraph - ;; M-w - ;; M-e - ;; M-r - rePositioning - ;; M-t transpose word - - ;; M-z zap-to-char - ;; M-x - ;; M-c capitalize-word - ;; M-v - ;; M-b -#+END_SRC - +* TODO todolist +** rucket +** player video on iphone for +** SICP +** music searcher +search music on some music web site