Emacs C++智能提示
Emacs中的C++程序智能提示是个不容易的活。我使用的是auto-completion插件。该插件依赖clang编译器进行代码分析,当然还依赖其他的emacs插件。下面是我的Emacs配置文件。
- ;;------------------------------------------------------------------------------
- ;; auto complete
- ;;------------------------------------------------------------------------------
- ;;(load-file (expand-file-name "/opt/emacs_plugins/c++/auto-complete-1.3.1")
- ;;(add-to-list 'load-path "/opt")
- ;;(require 'auto-complete-config)
- ;;(add-to-list 'ac-dictionary-directories "/opt/ac-dict")
- ;;(ac-config-default)
- (add-to-list 'load-path "/opt/emacs_plugins/c++/auto-complete-1.3.1")
- (require 'auto-complete-config)
- (add-to-list 'ac-dictionary-directories "/opt/ac-dict")
- ;;------------------------------------------------------------------------------
- ;; yasnippet
- ;;------------------------------------------------------------------------------
- ;;sudo apt-get install yasnippet
- (add-to-list 'load-path "/opt/emacs_plugins/c++")
- (add-to-list 'ac-dictionary-directories "/opt/emacs_plugins/c++")
- (require 'yasnippet-bundle)
- ;;------------------------------------------------------------------------------
- ;; clang for c++
- ;;------------------------------------------------------------------------------
- (load-file "/opt/emacs_plugins/c++/brianjcj-auto-complete-clang-9db79f4/auto-complete-clang.el")
- (require 'auto-complete-clang)
- (setq ac-auto-start nil)
- (setq ac-quick-help-delay 0.5)
- (define-key ac-mode-map [(control tab)] 'auto-complete)
- (defun my-ac-config ()
- (setq ac-clang-flags (split-string "-I/usr/local/gcc-4.6.1/include/c++/4.6.1 -I/usr/src/boost_1_47_0"))
- (setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
- (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
- ;;(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
- (add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
- (add-hook 'css-mode-hook 'ac-css-mode-setup)
- (add-hook 'auto-complete-mode-hook 'ac-common-setup)
- (global-auto-complete-mode t))
- (defun my-ac-cc-mode-setup ()
- (setq ac-sources (append '(ac-source-clang ac-source-yasnippet) ac-sources)))
- (add-hook 'c-mode-common-hook 'my-ac-cc-mode-setup)
- ;; ac-source-gtags
- (my-ac-config)
需要提示的时候,就按下Ctrl+Tab键。
相关推荐
文山羊 2020-11-07
susmote 2020-11-07
拉斯厄尔高福 2020-11-04
xceman 2020-10-23
hellojunz 2020-10-23
caojhuangy 2020-10-12
xinyupan 2020-09-28
lousir 2020-09-27
一个逗逗 2020-09-22
Maryhuan 2020-09-20
rkhstar 2020-09-09
DreamSnow 2020-09-09
aehousmantao 2020-09-03
tkernel 2020-09-03
abfdada 2020-08-26
svap 2020-08-25
二十不悔三十而立 2020-08-19
FlightForever 2020-08-17
joyjoy0 2020-08-13