├── README.md ├── custom ├── setup-c.el ├── setup-cedet.el ├── setup-editing.el ├── setup-general.el ├── setup-ggtags.el ├── setup-helm-gtags.el ├── setup-helm.el ├── setup-ivy-counsel.el └── setup-ivy-counsel.el~ └── init.el /README.md: -------------------------------------------------------------------------------- 1 | Emacs demo setup for C/C++ described here: http://tuhdo.github.io/c-ide.html 2 | -------------------------------------------------------------------------------- /custom/setup-c.el: -------------------------------------------------------------------------------- 1 | ;; company-c-headers 2 | (use-package company-c-headers 3 | :init 4 | (add-to-list 'company-backends 'company-c-headers)) 5 | 6 | ;; hs-minor-mode for folding source code 7 | (add-hook 'c-mode-common-hook 'hs-minor-mode) 8 | 9 | ;; Available C style: 10 | ;; “gnu”: The default style for GNU projects 11 | ;; “k&r”: What Kernighan and Ritchie, the authors of C used in their book 12 | ;; “bsd”: What BSD developers use, aka “Allman style” after Eric Allman. 13 | ;; “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler. 14 | ;; “stroustrup”: What Stroustrup, the author of C++ used in his book 15 | ;; “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel 16 | ;; “linux”: What the Linux developers use for kernel development 17 | ;; “python”: What Python developers use for extension modules 18 | ;; “java”: The default style for java-mode (see below) 19 | ;; “user”: When you want to define your own style 20 | (setq c-default-style) "linux" ;; set style to "linux" 21 | 22 | (use-package cc-mode 23 | :init 24 | (define-key c-mode-map [(tab)] 'company-complete) 25 | (define-key c++-mode-map [(tab)] 'company-complete)) 26 | 27 | (provide 'setup-c) 28 | -------------------------------------------------------------------------------- /custom/setup-cedet.el: -------------------------------------------------------------------------------- 1 | (require 'cc-mode) 2 | (require 'semantic) 3 | 4 | (global-semanticdb-minor-mode 1) 5 | (global-semantic-idle-scheduler-mode 1) 6 | (global-semantic-stickyfunc-mode 1) 7 | 8 | (semantic-mode 1) 9 | 10 | (defun alexott/cedet-hook () 11 | (local-set-key "\C-c\C-j" 'semantic-ia-fast-jump) 12 | (local-set-key "\C-c\C-s" 'semantic-ia-show-summary)) 13 | 14 | (add-hook 'c-mode-common-hook 'alexott/cedet-hook) 15 | (add-hook 'c-mode-hook 'alexott/cedet-hook) 16 | (add-hook 'c++-mode-hook 'alexott/cedet-hook) 17 | 18 | ;; Enable EDE only in C/C++ 19 | (require 'ede) 20 | (global-ede-mode) 21 | 22 | (provide 'setup-cedet) 23 | -------------------------------------------------------------------------------- /custom/setup-editing.el: -------------------------------------------------------------------------------- 1 | ;; GROUP: Editing -> Editing Basics 2 | (setq global-mark-ring-max 5000 ; increase mark ring to contains 5000 entries 3 | mark-ring-max 5000 ; increase kill ring to contains 5000 entries 4 | mode-require-final-newline t ; add a newline to end of file 5 | tab-width 4 ; default to 4 visible spaces to display a tab 6 | ) 7 | 8 | (add-hook 'sh-mode-hook (lambda () 9 | (setq tab-width 4))) 10 | 11 | (set-terminal-coding-system 'utf-8) 12 | (set-keyboard-coding-system 'utf-8) 13 | (set-language-environment "UTF-8") 14 | (prefer-coding-system 'utf-8) 15 | 16 | (setq-default indent-tabs-mode nil) 17 | (delete-selection-mode) 18 | (global-set-key (kbd "RET") 'newline-and-indent) 19 | 20 | ;; GROUP: Editing -> Killing 21 | (setq kill-ring-max 5000 ; increase kill-ring capacity 22 | kill-whole-line t ; if NIL, kill whole line and move the next line up 23 | ) 24 | 25 | ;; show whitespace in diff-mode 26 | (add-hook 'diff-mode-hook (lambda () 27 | (setq-local whitespace-style 28 | '(face 29 | tabs 30 | tab-mark 31 | spaces 32 | space-mark 33 | trailing 34 | indentation::space 35 | indentation::tab 36 | newline 37 | newline-mark)) 38 | (whitespace-mode 1))) 39 | 40 | ;; Package: volatile-highlights 41 | ;; GROUP: Editing -> Volatile Highlights 42 | (use-package volatile-highlights 43 | :init 44 | (volatile-highlights-mode t)) 45 | 46 | ;; Package: undo-tree 47 | ;; GROUP: Editing -> Undo -> Undo Tree 48 | (use-package undo-tree 49 | :init 50 | (global-undo-tree-mode 1)) 51 | 52 | 53 | ;; Package: yasnippet 54 | ;; GROUP: Editing -> Yasnippet 55 | ;; Package: yasnippet 56 | (use-package yasnippet 57 | :defer t 58 | :init 59 | (add-hook 'prog-mode-hook 'yas-minor-mode)) 60 | 61 | ;; Package: clean-aindent-mode 62 | (use-package clean-aindent-mode 63 | :init 64 | (add-hook 'prog-mode-hook 'clean-aindent-mode)) 65 | 66 | ;; Package: dtrt-indent 67 | (use-package dtrt-indent 68 | :init 69 | (dtrt-indent-mode 1) 70 | (setq dtrt-indent-verbosity 0)) 71 | 72 | ;; Package: ws-butler 73 | (use-package ws-butler 74 | :init 75 | (add-hook 'prog-mode-hook 'ws-butler-mode) 76 | (add-hook 'text-mode 'ws-butler-mode) 77 | (add-hook 'fundamental-mode 'ws-butler-mode)) 78 | 79 | ;; PACKAGE: comment-dwim-2 80 | (use-package comment-dwim-2 81 | :bind (("M-;" . comment-dwim-2)) 82 | ) 83 | 84 | ;; PACKAGE: anzu 85 | ;; GROUP: Editing -> Matching -> Isearch -> Anzu 86 | (use-package anzu 87 | :init 88 | (global-anzu-mode) 89 | (global-set-key (kbd "M-%") 'anzu-query-replace) 90 | (global-set-key (kbd "C-M-%") 'anzu-query-replace-regexp)) 91 | 92 | ;; PACKAGE: iedit 93 | (use-package iedit 94 | :bind (("C-;" . iedit-mode)) 95 | :init 96 | (setq iedit-toggle-key-default nil)) 97 | 98 | ;; Customized functions 99 | (defun prelude-move-beginning-of-line (arg) 100 | "Move point back to indentation of beginning of line. 101 | 102 | Move point to the first non-whitespace character on this line. 103 | If point is already there, move to the beginning of the line. 104 | Effectively toggle between the first non-whitespace character and 105 | the beginning of the line. 106 | 107 | If ARG is not nil or 1, move forward ARG - 1 lines first. If 108 | point reaches the beginning or end of the buffer, stop there." 109 | (interactive "^p") 110 | (setq arg (or arg 1)) 111 | 112 | ;; Move lines first 113 | (when (/= arg 1) 114 | (let ((line-move-visual nil)) 115 | (forward-line (1- arg)))) 116 | 117 | (let ((orig-point (point))) 118 | (back-to-indentation) 119 | (when (= orig-point (point)) 120 | (move-beginning-of-line 1)))) 121 | 122 | (global-set-key (kbd "C-a") 'prelude-move-beginning-of-line) 123 | 124 | (defadvice kill-ring-save (before slick-copy activate compile) 125 | "When called interactively with no active region, copy a single 126 | line instead." 127 | (interactive 128 | (if mark-active (list (region-beginning) (region-end)) 129 | (message "Copied line") 130 | (list (line-beginning-position) 131 | (line-beginning-position 2))))) 132 | 133 | (defadvice kill-region (before slick-cut activate compile) 134 | "When called interactively with no active region, kill a single 135 | line instead." 136 | (interactive 137 | (if mark-active (list (region-beginning) (region-end)) 138 | (list (line-beginning-position) 139 | (line-beginning-position 2))))) 140 | 141 | ;; kill a line, including whitespace characters until next non-whiepsace character 142 | ;; of next line 143 | (defadvice kill-line (before check-position activate) 144 | (if (member major-mode 145 | '(emacs-lisp-mode scheme-mode lisp-mode 146 | c-mode c++-mode objc-mode 147 | latex-mode plain-tex-mode)) 148 | (if (and (eolp) (not (bolp))) 149 | (progn (forward-char 1) 150 | (just-one-space 0) 151 | (backward-char 1))))) 152 | 153 | ;; taken from prelude-editor.el 154 | ;; automatically indenting yanked text if in programming-modes 155 | (defvar yank-indent-modes 156 | '(LaTeX-mode TeX-mode) 157 | "Modes in which to indent regions that are yanked (or yank-popped). 158 | Only modes that don't derive from `prog-mode' should be listed here.") 159 | 160 | (defvar yank-indent-blacklisted-modes 161 | '(python-mode slim-mode haml-mode) 162 | "Modes for which auto-indenting is suppressed.") 163 | 164 | (defvar yank-advised-indent-threshold 1000 165 | "Threshold (# chars) over which indentation does not automatically occur.") 166 | 167 | (defun yank-advised-indent-function (beg end) 168 | "Do indentation, as long as the region isn't too large." 169 | (if (<= (- end beg) yank-advised-indent-threshold) 170 | (indent-region beg end nil))) 171 | 172 | (defadvice yank (after yank-indent activate) 173 | "If current mode is one of 'yank-indent-modes, 174 | indent yanked text (with prefix arg don't indent)." 175 | (if (and (not (ad-get-arg 0)) 176 | (not (member major-mode yank-indent-blacklisted-modes)) 177 | (or (derived-mode-p 'prog-mode) 178 | (member major-mode yank-indent-modes))) 179 | (let ((transient-mark-mode nil)) 180 | (yank-advised-indent-function (region-beginning) (region-end))))) 181 | 182 | (defadvice yank-pop (after yank-pop-indent activate) 183 | "If current mode is one of `yank-indent-modes', 184 | indent yanked text (with prefix arg don't indent)." 185 | (when (and (not (ad-get-arg 0)) 186 | (not (member major-mode yank-indent-blacklisted-modes)) 187 | (or (derived-mode-p 'prog-mode) 188 | (member major-mode yank-indent-modes))) 189 | (let ((transient-mark-mode nil)) 190 | (yank-advised-indent-function (region-beginning) (region-end))))) 191 | 192 | ;; prelude-core.el 193 | (defun indent-buffer () 194 | "Indent the currently visited buffer." 195 | (interactive) 196 | (indent-region (point-min) (point-max))) 197 | 198 | ;; prelude-editing.el 199 | (defcustom prelude-indent-sensitive-modes 200 | '(coffee-mode python-mode slim-mode haml-mode yaml-mode) 201 | "Modes for which auto-indenting is suppressed." 202 | :type 'list) 203 | 204 | (defun indent-region-or-buffer () 205 | "Indent a region if selected, otherwise the whole buffer." 206 | (interactive) 207 | (unless (member major-mode prelude-indent-sensitive-modes) 208 | (save-excursion 209 | (if (region-active-p) 210 | (progn 211 | (indent-region (region-beginning) (region-end)) 212 | (message "Indented selected region.")) 213 | (progn 214 | (indent-buffer) 215 | (message "Indented buffer."))) 216 | (whitespace-cleanup)))) 217 | 218 | (global-set-key (kbd "C-c i") 'indent-region-or-buffer) 219 | 220 | ;; add duplicate line function from Prelude 221 | ;; taken from prelude-core.el 222 | (defun prelude-get-positions-of-line-or-region () 223 | "Return positions (beg . end) of the current line 224 | or region." 225 | (let (beg end) 226 | (if (and mark-active (> (point) (mark))) 227 | (exchange-point-and-mark)) 228 | (setq beg (line-beginning-position)) 229 | (if mark-active 230 | (exchange-point-and-mark)) 231 | (setq end (line-end-position)) 232 | (cons beg end))) 233 | 234 | ;; smart openline 235 | (defun prelude-smart-open-line (arg) 236 | "Insert an empty line after the current line. 237 | Position the cursor at its beginning, according to the current mode. 238 | With a prefix ARG open line above the current line." 239 | (interactive "P") 240 | (if arg 241 | (prelude-smart-open-line-above) 242 | (progn 243 | (move-end-of-line nil) 244 | (newline-and-indent)))) 245 | 246 | (defun prelude-smart-open-line-above () 247 | "Insert an empty line above the current line. 248 | Position the cursor at it's beginning, according to the current mode." 249 | (interactive) 250 | (move-beginning-of-line nil) 251 | (newline-and-indent) 252 | (forward-line -1) 253 | (indent-according-to-mode)) 254 | 255 | (global-set-key (kbd "M-o") 'prelude-smart-open-line) 256 | (global-set-key (kbd "M-o") 'open-line) 257 | 258 | (provide 'setup-editing) 259 | -------------------------------------------------------------------------------- /custom/setup-general.el: -------------------------------------------------------------------------------- 1 | (menu-bar-mode -1) 2 | (tool-bar-mode -1) 3 | 4 | (setq gc-cons-threshold 100000000) 5 | (setq inhibit-startup-message t) 6 | 7 | (defalias 'yes-or-no-p 'y-or-n-p) 8 | 9 | ;; show unncessary whitespace that can mess up your diff 10 | (add-hook 'prog-mode-hook 11 | (lambda () (interactive) 12 | (setq show-trailing-whitespace 1))) 13 | 14 | ;; use space to indent by default 15 | (setq-default indent-tabs-mode nil) 16 | 17 | ;; set appearance of a tab that is represented by 4 spaces 18 | (setq-default tab-width 4) 19 | 20 | ;; Compilation 21 | (global-set-key (kbd "") (lambda () 22 | (interactive) 23 | (setq-local compilation-read-command nil) 24 | (call-interactively 'compile))) 25 | 26 | ;; setup GDB 27 | (setq 28 | ;; use gdb-many-windows by default 29 | gdb-many-windows t 30 | 31 | ;; Non-nil means display source file containing the main routine at startup 32 | gdb-show-main t 33 | ) 34 | 35 | ;; company 36 | (use-package company 37 | :init 38 | (global-company-mode 1) 39 | (delete 'company-semantic company-backends)) 40 | ;; (define-key c-mode-map [(control tab)] 'company-complete) 41 | ;; (define-key c++-mode-map [(control tab)] 'company-complete) 42 | 43 | ;; Package: projejctile 44 | (use-package projectile 45 | :init 46 | (projectile-global-mode) 47 | (setq projectile-enable-caching t)) 48 | 49 | ;; Package zygospore 50 | (use-package zygospore 51 | :bind (("C-x 1" . zygospore-toggle-delete-other-windows) 52 | ("RET" . newline-and-indent))) 53 | 54 | ; automatically indent when press RET 55 | 56 | ;; activate whitespace-mode to view all whitespace characters 57 | (global-set-key (kbd "C-c w") 'whitespace-mode) 58 | (windmove-default-keybindings) 59 | 60 | (provide 'setup-general) 61 | -------------------------------------------------------------------------------- /custom/setup-ggtags.el: -------------------------------------------------------------------------------- 1 | (require 'ggtags) 2 | 3 | (ggtags-mode 1) 4 | (add-hook 'c-mode-common-hook 5 | (lambda () 6 | (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode) 7 | (ggtags-mode 1)))) 8 | 9 | (dolist (map (list ggtags-mode-map dired-mode-map)) 10 | (define-key map (kbd "C-c g s") 'ggtags-find-other-symbol) 11 | (define-key map (kbd "C-c g h") 'ggtags-view-tag-history) 12 | (define-key map (kbd "C-c g r") 'ggtags-find-reference) 13 | (define-key map (kbd "C-c g f") 'ggtags-find-file) 14 | (define-key map (kbd "C-c g c") 'ggtags-create-tags) 15 | (define-key map (kbd "C-c g u") 'ggtags-update-tags) 16 | (define-key map (kbd "C-c g a") 'helm-gtags-tags-in-this-function) 17 | (define-key map (kbd "M-.") 'ggtags-find-tag-dwim) 18 | (define-key map (kbd "M-,") 'pop-tag-mark) 19 | (define-key map (kbd "C-c <") 'ggtags-prev-mark) 20 | (define-key map (kbd "C-c >") 'ggtags-next-mark)) 21 | 22 | (provide 'setup-ggtags) 23 | -------------------------------------------------------------------------------- /custom/setup-helm-gtags.el: -------------------------------------------------------------------------------- 1 | ;; this variables must be set before load helm-gtags 2 | ;; you can change to any prefix key of your choice 3 | (setq helm-gtags-prefix-key "\C-cg") 4 | 5 | (use-package helm-gtags 6 | :init 7 | (progn 8 | (setq helm-gtags-ignore-case t 9 | helm-gtags-auto-update t 10 | helm-gtags-use-input-at-cursor t 11 | helm-gtags-pulse-at-cursor t 12 | helm-gtags-prefix-key "\C-cg" 13 | helm-gtags-suggested-key-mapping t) 14 | 15 | ;; Enable helm-gtags-mode in Dired so you can jump to any tag 16 | ;; when navigate project tree with Dired 17 | (add-hook 'dired-mode-hook 'helm-gtags-mode) 18 | 19 | ;; Enable helm-gtags-mode in Eshell for the same reason as above 20 | (add-hook 'eshell-mode-hook 'helm-gtags-mode) 21 | 22 | ;; Enable helm-gtags-mode in languages that GNU Global supports 23 | (add-hook 'c-mode-hook 'helm-gtags-mode) 24 | (add-hook 'c++-mode-hook 'helm-gtags-mode) 25 | (add-hook 'java-mode-hook 'helm-gtags-mode) 26 | (add-hook 'asm-mode-hook 'helm-gtags-mode) 27 | 28 | ;; key bindings 29 | (with-eval-after-load 'helm-gtags 30 | (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function) 31 | (define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select) 32 | (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim) 33 | (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack) 34 | (define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history) 35 | (define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history)))) 36 | 37 | (provide 'setup-helm-gtags) 38 | -------------------------------------------------------------------------------- /custom/setup-helm.el: -------------------------------------------------------------------------------- 1 | (use-package helm 2 | :init 3 | (progn 4 | (require 'helm-config) 5 | (require 'helm-grep) 6 | ;; To fix error at compile: 7 | ;; Error (bytecomp): Forgot to expand macro with-helm-buffer in 8 | ;; (with-helm-buffer helm-echo-input-in-header-line) 9 | (if (version< "26.0.50" emacs-version) 10 | (eval-when-compile (require 'helm-lib))) 11 | 12 | (defun helm-hide-minibuffer-maybe () 13 | (when (with-helm-buffer helm-echo-input-in-header-line) 14 | (let ((ov (make-overlay (point-min) (point-max) nil nil t))) 15 | (overlay-put ov 'window (selected-window)) 16 | (overlay-put ov 'face (let ((bg-color (face-background 'default nil))) 17 | `(:background ,bg-color :foreground ,bg-color))) 18 | (setq-local cursor-type nil)))) 19 | 20 | (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe) 21 | ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs. 22 | ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we 23 | ;; cannot change `helm-command-prefix-key' once `helm-config' is loaded. 24 | (global-set-key (kbd "C-c h") 'helm-command-prefix) 25 | (global-unset-key (kbd "C-x c")) 26 | 27 | (define-key helm-map (kbd "") 'helm-execute-persistent-action) ; rebihnd tab to do persistent action 28 | (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal 29 | (define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z 30 | 31 | (define-key helm-grep-mode-map (kbd "") 'helm-grep-mode-jump-other-window) 32 | (define-key helm-grep-mode-map (kbd "n") 'helm-grep-mode-jump-other-window-forward) 33 | (define-key helm-grep-mode-map (kbd "p") 'helm-grep-mode-jump-other-window-backward) 34 | 35 | (when (executable-find "curl") 36 | (setq helm-google-suggest-use-curl-p t)) 37 | 38 | (setq helm-google-suggest-use-curl-p t 39 | helm-scroll-amount 4 ; scroll 4 lines other window using M-/M- 40 | ;; helm-quick-update t ; do not display invisible candidates 41 | helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp. 42 | 43 | ;; you can customize helm-do-grep to execute ack-grep 44 | ;; helm-grep-default-command "ack-grep -Hn --smart-case --no-group --no-color %e %p %f" 45 | ;; helm-grep-default-recurse-command "ack-grep -H --smart-case --no-group --no-color %e %p %f" 46 | helm-split-window-in-side-p t ;; open helm buffer inside current window, not occupy whole other window 47 | 48 | helm-echo-input-in-header-line t 49 | 50 | ;; helm-candidate-number-limit 500 ; limit the number of displayed canidates 51 | helm-ff-file-name-history-use-recentf t 52 | helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source. 53 | helm-buffer-skip-remote-checking t 54 | 55 | helm-mode-fuzzy-match t 56 | 57 | helm-buffers-fuzzy-matching t ; fuzzy matching buffer names when non-nil 58 | ; useful in helm-mini that lists buffers 59 | helm-org-headings-fontify t 60 | ;; helm-find-files-sort-directories t 61 | ;; ido-use-virtual-buffers t 62 | helm-semantic-fuzzy-match t 63 | helm-M-x-fuzzy-match t 64 | helm-imenu-fuzzy-match t 65 | helm-lisp-fuzzy-completion t 66 | ;; helm-apropos-fuzzy-match t 67 | helm-buffer-skip-remote-checking t 68 | helm-locate-fuzzy-match t 69 | helm-display-header-line nil) 70 | 71 | (add-to-list 'helm-sources-using-default-as-input 'helm-source-man-pages) 72 | 73 | (global-set-key (kbd "M-x") 'helm-M-x) 74 | (global-set-key (kbd "M-y") 'helm-show-kill-ring) 75 | (global-set-key (kbd "C-x b") 'helm-buffers-list) 76 | (global-set-key (kbd "C-x C-f") 'helm-find-files) 77 | (global-set-key (kbd "C-c r") 'helm-recentf) 78 | (global-set-key (kbd "C-h SPC") 'helm-all-mark-rings) 79 | (global-set-key (kbd "C-c h o") 'helm-occur) 80 | (global-set-key (kbd "C-c h o") 'helm-occur) 81 | 82 | (global-set-key (kbd "C-c h w") 'helm-wikipedia-suggest) 83 | (global-set-key (kbd "C-c h g") 'helm-google-suggest) 84 | 85 | (global-set-key (kbd "C-c h x") 'helm-register) 86 | ;; (global-set-key (kbd "C-x r j") 'jump-to-register) 87 | 88 | (define-key 'help-command (kbd "C-f") 'helm-apropos) 89 | (define-key 'help-command (kbd "r") 'helm-info-emacs) 90 | (define-key 'help-command (kbd "C-l") 'helm-locate-library) 91 | 92 | ;; use helm to list eshell history 93 | (add-hook 'eshell-mode-hook 94 | #'(lambda () 95 | (define-key eshell-mode-map (kbd "M-l") 'helm-eshell-history))) 96 | 97 | ;;; Save current position to mark ring 98 | (add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring) 99 | 100 | ;; show minibuffer history with Helm 101 | (define-key minibuffer-local-map (kbd "M-p") 'helm-minibuffer-history) 102 | (define-key minibuffer-local-map (kbd "M-n") 'helm-minibuffer-history) 103 | 104 | (define-key global-map [remap find-tag] 'helm-etags-select) 105 | 106 | (define-key global-map [remap list-buffers] 'helm-buffers-list) 107 | 108 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 109 | ;; PACKAGE: helm-swoop ;; 110 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 111 | ;; Locate the helm-swoop folder to your path 112 | (use-package helm-swoop 113 | :bind (("C-c h o" . helm-swoop) 114 | ("C-c s" . helm-multi-swoop-all)) 115 | :config 116 | ;; When doing isearch, hand the word over to helm-swoop 117 | (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch) 118 | 119 | ;; From helm-swoop to helm-multi-swoop-all 120 | (define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop) 121 | 122 | ;; Save buffer when helm-multi-swoop-edit complete 123 | (setq helm-multi-swoop-edit-save t) 124 | 125 | ;; If this value is t, split window inside the current window 126 | (setq helm-swoop-split-with-multiple-windows t) 127 | 128 | ;; Split direcion. 'split-window-vertically or 'split-window-horizontally 129 | (setq helm-swoop-split-direction 'split-window-vertically) 130 | 131 | ;; If nil, you can slightly boost invoke speed in exchange for text color 132 | (setq helm-swoop-speed-or-color t)) 133 | 134 | (helm-mode 1) 135 | 136 | (use-package helm-projectile 137 | :init 138 | (helm-projectile-on) 139 | (setq projectile-completion-system 'helm) 140 | (setq projectile-indexing-method 'alien)))) 141 | 142 | (provide 'setup-helm) 143 | -------------------------------------------------------------------------------- /custom/setup-ivy-counsel.el: -------------------------------------------------------------------------------- 1 | (use-package ivy 2 | :init 3 | (progn 4 | (ivy-mode 1) 5 | (setq ivy-use-virtual-buffers t) 6 | (global-set-key (kbd "C-c s") 'swiper))) 7 | 8 | (use-package counsel 9 | :bind 10 | (("M-x" . counsel-M-x) 11 | ("M-y" . counsel-yank-pop) 12 | ("C-c r" . counsel-recentf) 13 | ("C-x C-f" . counsel-find-file) 14 | (" f" . counsel-describe-function) 15 | (" v" . counsel-describe-variable) 16 | (" l" . counsel-load-library) 17 | ("C-h f" . counsel-describe-function) 18 | ("C-h v" . counsel-describe-variable) 19 | ("C-h l" . counsel-load-library))) 20 | 21 | (use-package counsel-projectile 22 | :init 23 | (counsel-projectile-mode)) 24 | 25 | (provide 'setup-ivy-counsel) 26 | -------------------------------------------------------------------------------- /custom/setup-ivy-counsel.el~: -------------------------------------------------------------------------------- 1 | (require 'ivy) 2 | 3 | (ivy-mode 1) 4 | 5 | (setq ivy-re-builders-alist 6 | '((read-file-name-internal . ivy--regex-fuzzy) 7 | (t . ivy--regex-plus))) 8 | 9 | (setq ivy-use-virtual-buffers t) 10 | 11 | (global-set-key (kbd "M-x") 'counsel-M-x) 12 | (global-set-key (kbd "M-y") 'counsel-yank-pop) 13 | (global-set-key (kbd "C-x C-f") 'counsel-find-file) 14 | (global-set-key (kbd " f") 'counsel-describe-function) 15 | (global-set-key (kbd " v") 'counsel-describe-variable) 16 | (global-set-key (kbd " l") 'counsel-load-library) 17 | (global-set-key (kbd "C-h f") 'counsel-describe-function) 18 | (global-set-key (kbd "C-h v") 'counsel-describe-variable) 19 | (global-set-key (kbd "C-h l") 'counsel-load-library) 20 | 21 | (global-set-key (kbd "C-c s") 'swiper) 22 | 23 | (provide 'setup-ivy-counsel) 24 | -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | (require 'package) 2 | (add-to-list 'package-archives 3 | '("melpa" . "http://melpa.org/packages/") t) 4 | 5 | (package-initialize) 6 | 7 | (when (not package-archive-contents) 8 | (package-refresh-contents)) 9 | 10 | (unless (package-installed-p 'use-package) 11 | (package-install 'use-package)) 12 | 13 | (require 'use-package) 14 | (setq use-package-always-ensure t) 15 | 16 | (add-to-list 'load-path "~/.emacs.d/custom") 17 | 18 | (require 'setup-general) 19 | (if (version< emacs-version "24.4") 20 | (require 'setup-ivy-counsel) 21 | (require 'setup-helm) 22 | (require 'setup-helm-gtags)) 23 | ;; (require 'setup-ggtags) 24 | (require 'setup-cedet) 25 | (require 'setup-editing) 26 | 27 | 28 | 29 | ;; function-args 30 | ;; (require 'function-args) 31 | ;; (fa-config-default) 32 | ;; (define-key c-mode-map [(tab)] 'company-complete) 33 | ;; (define-key c++-mode-map [(tab)] 'company-complete) 34 | (custom-set-variables 35 | ;; custom-set-variables was added by Custom. 36 | ;; If you edit it by hand, you could mess it up, so be careful. 37 | ;; Your init file should contain only one such instance. 38 | ;; If there is more than one, they won't work right. 39 | '(package-selected-packages 40 | (quote 41 | (zygospore helm-gtags helm yasnippet ws-butler volatile-highlights use-package undo-tree iedit dtrt-indent counsel-projectile company clean-aindent-mode anzu)))) 42 | (custom-set-faces 43 | ;; custom-set-faces was added by Custom. 44 | ;; If you edit it by hand, you could mess it up, so be careful. 45 | ;; Your init file should contain only one such instance. 46 | ;; If there is more than one, they won't work right. 47 | ) 48 | --------------------------------------------------------------------------------