forked from CachesToCaches/emacs_cpp_completion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpp_completion.el
54 lines (51 loc) · 1.83 KB
/
cpp_completion.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;; == cpp_completion.el ==
;; Author: Gregory J. Stein
;; Email: [email protected]
;; License: None; feel free to use at will.
;; == Set up use-package ==
;; Uncomment the following if use-package is not installed
;; (require 'package)
;; (setq package-enable-at-startup nil)
;; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
;; (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
;; (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
;; (package-initialize)
;; (unless (package-installed-p 'use-package)
;; (package-refresh-contents)
;; (package-install 'use-package))
;; (eval-when-compile (require 'use-package))
;; == irony-mode ==
(use-package irony
:ensure t
:defer t
:init
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
:config
;; 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)
)
;; == company-mode ==
(use-package company
:ensure t
:defer t
:init (add-hook 'after-init-hook 'global-company-mode)
:config
(use-package company-irony :ensure t :defer t)
(setq company-idle-delay nil
company-minimum-prefix-length 2
company-show-numbers t
company-tooltip-limit 20
company-dabbrev-downcase nil
company-backends '((company-irony company-gtags))
)
:bind ("C-;" . company-complete-common)
)