(use-package ido-exit-target
:ensure t
:init
- (mapcar (lambda (map)
- (define-key map (kbd "C-j") #'ido-exit-target-split-window-right)
+ (mapcar '(lambda (map)
+ (define-key map (kbd "C-j") #'ido-exit-target-other-window)
(define-key map (kbd "C-k") #'ido-exit-target-split-window-below))
(list ido-buffer-completion-map
;; ido-common-completion-map
(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))
+ (setq org-completion-use-ido t)
+ (setq org-startup-with-inline-images t))
(org-babel-do-load-languages
'org-babel-load-languages
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)
- )
-
+ :init (add-hook 'org-mode-hook 'worf-mode))
#+END_SRC
** Get Things Done
#+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)")
#+END_SRC
* Misc Settings
-
** [[https://github.com/abo-abo/hydra][Hydra]]
*** hydra install
#+BEGIN_SRC emacs-lisp :tangle yes :results silent
:ensure t)
#+END_SRC
+** Local Variable hooks
+[[https://www.emacswiki.org/emacs/LocalVariables][LocalVariables]], use =hack-local-variables-hook=, run a hook to set local variable in mode hook
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; make Emacs run a new "local variables hook" for each major mode
+ (add-hook 'hack-local-variables-hook 'run-local-vars-mode-hook)
+
+ (defun run-local-vars-mode-hook ()
+ "Run a hook for the major-mode after the local variables have been processed."
+ (run-hooks (intern (concat (symbol-name major-mode) "-local-vars-hook"))))
+
+ ;; (add-hook 'c++-mode-local-vars-hook #'sd/c++-mode-local-vars)
+#+END_SRC
+
* Dired
** Dired bindings
=C-o= is defined as a global key for window operation, here unset it in dired mode
(interactive)
(dired-why)
(message
- "Δ: d-delete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, c-create, +new dir, r-evert, /-filter, h-summary, ?-help"))
+ "Δ: d-delete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, c-create, +new dir, r-evert, /-filter, v-iew, l-ist, z-Size, h-summary, ?-help"))
(defun sd/dired-high-level-dir ()
"Go to higher level directory"
#+END_SRC
** C & C++
+C/C++ ide tools
+1. completion (file name, function name, variable name)
+2. template yasnippet (keywords, if, function)
+3. tags jump
*** c/c++ style
#+BEGIN_SRC emacs-lisp :tangle yes :results silent
(setq c-default-style "stroustrup"
#+END_SRC
*** irony
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- (use-package irony
- :ensure t
- :config
- (add-hook 'c++-mode-hook 'irony-mode)
- (add-hook 'c-mode-hook 'irony-mode)
- (add-hook 'objc-mode-hook 'irony-mode))
-#+END_SRC
-
+**** install irony server
Install clang, on mac, it has =libclang.dylib=, but no develop headers. Install by =brew=
#+BEGIN_SRC sh
brew install llvm --with-clang
/Users/peli3/.emacs.d/elpa/irony-20160713.1245/server && cmake --build . --use-stderr --config Release --target install
#+END_SRC
+**** irony config
irony-mode-hook, copied from [[https://github.com/Sarcasm/irony-mode][irony-mode]] github
#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package irony
+ :ensure t
+ :config
+ (add-hook 'c++-mode-hook 'irony-mode)
+ (add-hook 'c-mode-hook 'irony-mode)
+ (add-hook 'objc-mode-hook 'irony-mode))
+
;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's function
+
(defun my-irony-mode-hook ()
(define-key irony-mode-map [remap completion-at-point]
'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async))
+
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
+
+ (add-hook 'c++-mode-local-vars-hook #'sd/c++-mode-local-vars)
+
+ ;; add C++ completions, because by default c++ file can not complete
+ ;; c++ std functions, another method is create .dir-local.el file, for p
+ ;; for project see irony
+ (defun sd/c++-mode-local-vars ()
+ (setq irony--compile-options
+ '("-std=c++11"
+ "-stdlib=libc++"
+ "-I/usr/include/c++/4.2.1")))
#+END_SRC
irony-company
(use-package company-irony
:ensure t)
- (eval-after-load 'company
- '(add-to-list 'company-backends 'company-irony))
-
(use-package flycheck-irony
:ensure t)
- (eval-after-load 'flycheck
- '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
+ (use-package company-c-headers
+ :ensure t
+ :config
+ (add-to-list 'company-c-headers-path-system "/usr/include/c++/4.2.1/"))
+
+ (with-eval-after-load 'company
+ (add-to-list 'company-backends 'company-irony)
+ (add-to-list 'company-backends 'company-c-headers))
+
+
+ (with-eval-after-load 'flycheck
+ (add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
#+END_SRC
*** gtags
*** yasnippet
#+BEGIN_SRC emacs-lisp :tangle yes :results silent
(use-package yasnippet
- :ensure t)
+ :ensure t
+ :defer t
+ ;; :config
+ )
+ ;; (yas-reload-all)
+ ;; (add-hook 'prog-mode-hook #'yas-minor-mode)
+ ;; (yas-global-mode 1)
+
#+END_SRC
*** semantic
(use-package google-c-style
:ensure t
:config
- (add-hook 'c-mode-hook 'google-set-c-style))
+ (add-hook 'c-mode-hook 'google-set-c-style)
+ (add-hook 'c++-mode-hook 'google-set-c-style))
#+END_SRC
** Lua
(kill-buffer)
(sd/delete-current-window))
"kill" :exit t)
- ("'" other-window "other" :exit t)
+
+ ;; ace-window
+ ;; ("'" other-window "other" :exit t)
;; ("a" ace-window "ace")
("s" ace-swap-window "swap")
+ ("D" ace-delete-window "ace-one" :exit t)
;; ("i" ace-maximize-window "ace-one" :exit t)
;; Windows undo - redo
("u" (progn (winner-undo) (setq this-command 'winner-undo)) "undo")
("r" (progn (winner-redo) (setq this-command 'winner-redo)) "redo")
-
+
;; ibuffer, dired, eshell, bookmarks
- ("D" ace-delete-window "ace-one" :exit t)
- ;; ("C-o" ido-switch-buffer nil :exit t)
+ ;; ("C-i" other-window nil :exit t)
("C-b" ido-switch-buffer nil :exit t)
- ("C-i" other-window nil :exit t)
+ ("C-f" projectile-find-file nil :exit t)
+ ("C-p" persp-switch :exit t)
+
+ ;; other special buffers
("d" sd/project-or-dired-jump nil :exit t)
("b" ibuffer 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)
- ("p" persp-switch :exit t)
;; ("p" paradox-list-packages nil :exit t)
;; quit