* 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/")
("org" . "http://orgmode.org/elpa/")))
(package-initialize)
-
#+END_SRC
** General Setting
#+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
: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
#+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
#+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
(latex . t)
(java . t)
(ruby . t)
+ (lua . t)
(lisp . t)
(scheme . t)
(sh . t)
(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
#+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
#+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)
#+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
** 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
#+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"))
(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
nil nil)
ret))
- (defun sd/toggle-eshell-here ()
+ (defun sd/toggle-project-eshell ()
"Toggle a eshell buffer vertically"
(interactive)
(if (sd/window-has-eshell)
(delete-window)))
(select-window (sd/window-has-eshell)))
(progn
- (let ((dir default-directory))
+ (split-window-vertically (- (/ (window-total-height) 3)))
+ (other-window 1)
+ (if (projectile-project-p)
+ (projectile-run-eshell)
+ (eshell))
+ ;; (let ((dir default-directory))
- (split-window-vertically (- (/ (window-total-height) 3)))
- (other-window 1)
- (unless (and (boundp 'eshell-buffer-name) (get-buffer eshell-buffer-name))
- (eshell))
- (switch-to-buffer eshell-buffer-name)
- (goto-char (point-max))
- (eshell-kill-input)
- (insert (format "cd %s" dir))
- (eshell-send-input)))))
+ ;; (split-window-vertically (- (/ (window-total-height) 3)))
+ ;; (other-window 1)
+ ;; (unless (and (boundp 'eshell-buffer-name) (get-buffer eshell-buffer-name))
+ ;; (eshell))
+ ;; (switch-to-buffer eshell-buffer-name)
+ ;; (goto-char (point-max))
+ ;; (eshell-kill-input)
+ ;; (insert (format "cd %s" dir))
+ ;; (eshell-send-input))
+ )))
;; (global-unset-key (kbd "M-`"))
- (global-set-key (kbd "s-e") 'sd/toggle-eshell-here)
+ (global-set-key (kbd "s-e") 'sd/toggle-project-eshell)
#+END_SRC
** exec-path-from-shell
(exec-path-from-shell-initialize))
#+END_SRC
-** TODO smart display
* Misc Settings
** [[https://github.com/abo-abo/hydra][Hydra]]
#+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
(show-trailing-whitespace . nil)
(tab-width . 8)
(eval . (whitespace-mode -1))
- (eval . (when buffer-file-name
- (setq-local view-no-disable-on-exit t)
- (view-mode-enter)))))))
+ ;; (eval . (when buffer-file-name
+ ;; (setq-local view-no-disable-on-exit t)
+ ;; (view-mode-enter)))
+ ))))
;; (dir-locals-set-directory-class (expand-file-name "/usr/local/share/emacs") 'emacs)
(dir-locals-set-directory-class "/usr/local/Cellar/emacs" 'emacs)
;; (dir-locals-set-directory-class "~/.emacs.d/elpa" 'emacs)
(dir-locals-set-directory-class "~/dotfiles/emacs.d/elpa" 'emacs)
(dir-locals-set-directory-class "~/dotfiles/emacs.d/el-get" 'emacs)
+
+ ;; temp-mode.el
+ ;; Temporary minor mode
+ ;; Main use is to enable it only in specific buffers to achieve the goal of
+ ;; buffer-specific keymaps
+
+ ;; (defvar sd/temp-mode-map (make-sparse-keymap)
+ ;; "Keymap while temp-mode is active.")
+
+ ;; ;;;###autoload
+ ;; (define-minor-mode sd/temp-mode
+ ;; "A temporary minor mode to be activated only specific to a buffer."
+ ;; nil
+ ;; :lighter " Temp"
+ ;; sd/temp-mode-map)
+
+ ;; (defun sd/temp-hook ()
+ ;; (if sd/temp-mode
+ ;; (progn
+ ;; (define-key sd/temp-mode-map (kbd "q") 'quit-window))))
+
+ ;; (add-hook 'lispy-mode-hook (lambda ()
+ ;; (sd/temp-hook)))
#+END_SRC
** Info plus
(require 'info+))
#+END_SRC
-** TODO bookmark
-
-** TODO Calendar
** advice info
#+BEGIN_SRC emacs-lisp :tangle yes :results silent
(defun sd/info-mode ()
(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)
(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
+
* Dired
** Dired bindings
=C-o= is defined as a global key for window operation, here unset it in dired mode
(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
'(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
** 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 <iostream>" \n
- "#include \""
+ "//#include \""
(file-name-sans-extension
(file-name-nondirectory (buffer-file-name)))
".hpp\"" \n \n
"int main ()"
"\n{" \n
> _ \n
- "return 1;"
+ "return 0;"
"\n}" > \n
)))
" * " (file-name-nondirectory (buffer-file-name)) "\n"
" */" > \n \n
"#include <stdio.h>" \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
("C-o" ido-switch-buffer nil :exit t)
("d" sd/project-or-dired-jump nil :exit t)
("b" ibuffer nil :exit t)
- ("e" eshell nil :exit t)
+ ("e" sd/toggle-project-eshell nil :exit t)
("m" bookmark-jump-other-window nil :exit t)
("M" bookmark-set nil :exit t)
("g" magit-status nil :exit t)
#+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 jump last change point
+* TODO todolist
+** rucket
+** player video on iphone for
+** SICP
+** music searcher
+search music on some music web site