-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-auto-complete.el
167 lines (142 loc) · 5.51 KB
/
init-auto-complete.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
;;; init-auto-complete.el --- Configuration for auto-complete mode
;; Filename: init-auto-complete.el
;; Description: Configuration for auto-complete mode
;; Author: Andy Stewart [email protected]
;; Maintainer: Andy Stewart [email protected]
;; Copyright (C) 2008, 2009, Andy Stewart, all rights reserved.
;; Created: 2008-12-02 11:08:12
;; Version: 0.1
;; Last-Updated: 2008-12-02 11:08:15
;; By: Andy Stewart
;; URL:
;; Keywords: auto-complete
;; Compatibility: GNU Emacs 23.0.60.1
;;
;; Features that might be required by this library:
;;
;; `auto-complete' `auto-complete-extension'
;;
;;; This file is NOT part of GNU Emacs
;;; License
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;;
;; Configuration for auto-complete mode
;;
;;; Installation:
;;
;; Put init-auto-complete.el to your load-path.
;; The load-path is usually ~/elisp/.
;; It's set in your ~/.emacs like this:
;; (add-to-list 'load-path (expand-file-name "~/elisp"))
;;
;; And the following to your ~/.emacs startup file.
;;
;; (require 'init-auto-complete)
;;
;; No need more.
;;; Change log:
;;
;; 2008/12/02
;; First released.
;;
;;; Acknowledgements:
;;
;;
;;
;;; TODO
;;
;;
;;
;;; Require
(require 'auto-complete)
(require 'auto-complete-config)
;;(require 'auto-complete-extension nil t) ;optional
;;(require 'auto-complete-yasnippet nil t) ;optional
;;(require 'auto-complete-semantic nil t) ;optional
;;(require 'auto-complete-etags nil t) ;optional
;;(require 'auto-complete-gtags nil t) ;optional
;;; Code:
;; Generic setup.
(global-auto-complete-mode t) ;enable global-mode
;;(setq ac-auto-start t) ;automatically start
;;(setq ac-dwim t) ;Do what i mean
;;(setq ac-override-local-map nil) ;don't override local map
;; The mode that automatically startup.
(setq ac-modes
'(emacs-lisp-mode lisp-interaction-mode lisp-mode scheme-mode
c-mode cc-mode c++-mode java-mode
perl-mode cperl-mode python-mode ruby-mode
ecmascript-mode javascript-mode php-mode css-mode
makefile-mode sh-mode fortran-mode f90-mode ada-mode
xml-mode sgml-mode
haskell-mode literate-haskell-mode
emms-tag-editor-mode
asm-mode
org-mode))
;; (add-to-list 'ac-trigger-commands 'org-self-insert-command) ; if you want enable auto-complete at org-mode, uncomment this line
;; The sources for common all mode.
(custom-set-variables
'(ac-sources
'(ac-source-yasnippet ;this source need file `auto-complete-yasnippet.el'
ac-source-semantic ;this source need file `auto-complete-semantic.el'
ac-source-abbrev
ac-source-words-in-buffer
ac-source-files-in-current-dir
ac-source-filename)
;; (dolist (hook (list
;; 'emacs-lisp-mode-hook
;; 'lisp-interaction-mode
;; ))
;; (add-hook hook '(lambda ()
;; (add-to-list 'ac-sources 'ac-source-symbols))))
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; c-common-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Enables comnicompletion with `c-mode-common'.
(add-hook 'c-mode-common-hook
'(lambda ()
(add-to-list 'ac-sources 'ac-source-etags)
(local-set-key "\C-xt" 'eassist-switch-h-cpp)
(local-set-key "\C-ce" 'eassist-list-methods)
(local-set-key "\C-c\C-r" 'semantic-symref))
)
(defun set-key-completion-hook ()
"Set up hot keys for make auto complete."
(local-set-key [(control return)]
'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c?" 'auto-complete)
;; (local-set-key "\C-x?" 'semantic-ia-complete-symbol)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key "\C-c=" 'semantic-decoration-include-visit)
(local-set-key "\C-cq" 'semantic-ia-show-doc)
(local-set-key "\C-cj" 'semantic-ia-fast-jump)
(local-set-key "\C-cs" 'semantic-ia-show-summary)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle))
(add-hook 'c-mode-common-hook 'set-key-completion-hook)
(add-hook 'lisp-mode-hook 'set-key-completion-hook)
(add-hook 'emacs-lisp-mode-hook 'set-key-completion-hook)
;; (defun semantic-and-gtags-complete ()
;; (interactive)
;; (auto-complete '(ac-source-semantic ac-source-gtags)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; c++-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keywords.
;; (add-hook 'c++-mode-hook '(lambda ()
;; (add-to-list 'ac-sources 'ac-c++-sources)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; haskell mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keywords.
;; (add-hook 'haskell-mode-hook '(lambda ()
;; (add-to-list 'ac-sources 'ac-source-haskell)))
(provide 'init-auto-complete)
;;; init-auto-complete.el ends here