寻找c++ 头文件
echo "" | g++ -v -x c++ -E -
我的emacs 整个配置如下:
(setq initial-scratch-message "")
(setq inhibit-startup-message t)
(global-linum-mode 1)
(add-to-list 'load-path "~/.emacs.d/some_el/")
(require 'auto-complete-clang-async)
(defun ac-cc-mode-setup ()
(setq ac-clang-complete-executable "~/.emacs.d/some_el/clang-complete")
(setq ac-sources '(ac-source-clang-async))
(ac-clang-launch-completion-process)
)
;;auto-complete
(require 'auto-complete)
(require 'auto-complete-config)
;; 结束
;; 开启 auto-complete-clang
(require 'auto-complete-clang)
;;(setq ac-clang-auto-save t)
;; 设置不自动启动
(setq ac-auto-start t)
;; 设置响应时间 0.5
(setq ac-quick-help-delay 0.5)
(ac-set-trigger-key "TAB")
(define-key ac-mode-map [(control tab)] 'auto-complete)
;; 提示快捷键为 M-/
(define-key ac-mode-map (kbd "M-/") 'auto-complete)
(defun my-ac-config ()
(setq ac-clang-flags
(mapcar(lambda (item)(concat "-I" item))
(split-string
"
/usr/include/c++/4.8
/usr/include/x86_64-linux-gnu/c++/4.8
/usr/include/c++/4.8/backward
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
/home/ada/tags/c/include/
/home/ada/tags/c/libc/include/
/home/ada/tags/c++/include/std
"
)))
(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)
;;test code
;;/usr/include/c++/4.8/
;; /usr/include/c++/4.8/backward/
;; /usr/local/include/
;; /usr/include/
;;/usr/include/c++/4.8
;;/home/ada/tags/c++/include/std/
;; /home/ada/tags/c++/include/bits/
;; /home/ada/tags/c++/include/ext/
(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)
(ac-config-default)
;; 结束
(require 'company-rtags)
(setq company-backends '(company-rtags))
(company-mode)
(rtags-diagnostics)
(tool-bar-mode -1)
(defalias 'yes-or-no-p 'y-or-no-p)
(add-to-list 'load-path "~/.emacs.d/plugins/wubi")
(require 'wubi)
(wubi-load-local-phrases)
(register-input-method
"chinese-wubi" " Chinese-GB" 'quail-use-packag
"WuBi" "WuBi"
"wubi"
)
(set-language-environment "Chinese-GB")
(setq default-input-method "chinese-wubi")
;; company-c-headers
(add-to-list 'company-backends 'company-c-headers)
(setq c-default-style "linux")
(global-set-key (kbd "RET") 'newline-and-indent) ; automatically indent when press RET
(global-set-key (kbd "C-c w") 'whitespace-mode)
;; show unncessary whitespace that can mess up your diff
(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1)))
;; use space to indent by default
(setq-default indent-tabs-mode nil)
;; set appearance of a tab that is represented by 4 spaces
(setq-default tab-width 4)
;; Package: ws-butler
(require 'ws-butler)
(add-hook 'prog-mode-hook 'ws-butler-mode)
;; Package: yasnippet
;;(require 'yasnippet)
;;(yas-global-mode 1)
(global-set-key (kbd "C-x 1") 'zygospore-toggle-delete-other-windows)
;;myself add some
(require 'ggtags)
(add-hook 'c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
(ggtags-mode 1))))
(define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol)
(define-key ggtags-mode-map (kbd "C-c g h") 'ggtags-view-tag-history)
(define-key ggtags-mode-map (kbd "C-c g r") 'ggtags-find-reference)
(define-key ggtags-mode-map (kbd "C-c g f") 'ggtags-find-file)
(define-key ggtags-mode-map (kbd "C-c g c") 'ggtags-create-tags)
(define-key ggtags-mode-map (kbd "C-c g u") 'ggtags-update-tags)
(define-key ggtags-mode-map (kbd "M-,") 'pop-tag-mark)
(setq-local imenu-create-index-function #'ggtags-build-imenu-index)
(setq speedbar-show-unknown-files t)
(require 'sr-speedbar)
(setq speedbar-use-images nil)
(setq company-backends (delete 'company-semantic company-backends))
(require 'cc-mode)
(require 'semantic)
(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(semantic-mode 1)
;;(semantic-add-system-include "/usr/local/include/")
(semantic-add-system-include "/usr/include/")
(defun new-scratch ()
"open up a guaranteed new scratch buffer"
(interactive)
(switch-to-buffer (loop for num from 0
for name = (format "buf%i" num)
while (get-buffer name)
finally return name)))
(global-set-key (kbd "C-c n") #'new-scratch)
(setq speedbar-tag-hierarchy-method nil)
(put 'narrow-to-region 'disabled nil)
;;add by yqda
;; vi-like line insertion
(global-set-key (kbd "C-o") (lambda () (interactive)(beginning-of-line)(open-line 1)))
(global-set-key (kbd "M-o") (lambda () (interactive)(end-of-line)(newline)))
(setq-default major-mode 'c++-mode)
;;(global-set-key"\C-x\C-b" 'buffer-menu)
;; initial frame size))
(setq default-frame-alist
'((height . 30)(width . 100)(menubar-lines . 20)(tool-bar-lines . 0)))
;;display time
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq visible-bell nil)
(setq resize-mini-windows nil)
;;auto pair
(show-paren-mode t)
(require 'autopair)
(autopair-global-mode)
;;recursive minibuffer
(setq enable-recursive-minibuffers t)
(setq make-backup-files nil)
(setq-default make-backup-files nil)
(setq x-select-enable-clipboard t)
(set-clipboard-coding-system 'ctext)
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
;;auto load modified files
(global-auto-revert-mode t)
(setq custom-buffer-style 'brackets)
;;(ido-mode t)
;;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插入两个空格。
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
;;可以递归的使用 minibuffer
(setq enable-recursive-minibuffers t)
;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文
(setq scroll-margin 3 scroll-conservatively 10000)
;; 在行首 C-k 时,同时删除该行。
(setq-default kill-whole-line t)
;;当你在shell、telnet、w3m等模式下时,必然碰到过要输入密码的情况,此时加密显出你的密码
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt)
;;允许emacs和外部其他程序的粘贴
(setq x-select-enable-clipboard t)
;;使用鼠标中键可以粘贴
(setq mouse-yank-at-point t)
;; 自动的在文件末增加一新行
(setq require-final-newline t)
;; 当浏览 man page 时,直接跳转到 man buffer。
(setq Man-notify-method 'pushy)
(setq speedbar-show-unknown-files t);;可以显示所有目录以及文件
;;(setq dframe-update-speed nil);;不自动刷新,手动 g 刷新
(setq speedbar-update-flag nil)
(setq speedbar-use-images nil);;不使用 image 的方式
(setq speedbar-verbosity-level 0)
;;让 dired 可以递归的拷贝和删除目录。
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
;; 设置时间戳,标识出最后一次保存文件的时间。
(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S yqda")
;====================== rect-mark设置 =========================
;; 按下shift拖拽鼠标即可选择矩形区域
;; Support for marking a rectangle of text with highlighting.
(require 'rect-mark)
(define-key ctl-x-map "r\C-@" 'rm-set-mark)
(define-key ctl-x-map [?r ?\C-\ ] 'rm-set-mark)
(define-key ctl-x-map "r\C-x" 'rm-exchange-point-and-mark)
(define-key ctl-x-map "r\C-w" 'rm-kill-region)
(define-key ctl-x-map "r\M-w" 'rm-kill-ring-save)
(define-key global-map [S-down-mouse-1] 'rm-mouse-drag-region)
(autoload 'rm-set-mark "rect-mark"
"Set mark for rectangle." t)
(autoload 'rm-exchange-point-and-mark "rect-mark"
"Exchange point and mark for rectangle." t)
(autoload 'rm-kill-region "rect-mark"
"Kill a rectangular region and save it in the kill ring." t)
(autoload 'rm-kill-ring-save "rect-mark"
"Copy a rectangular region to the kill ring." t)
(autoload 'rm-mouse-drag-region "rect-mark"
"Drag out a rectangular region with the mouse." t)
;; One vision of a better picture mode.
(add-hook 'picture-mode-hook 'rm-example-picture-mode-bindings)
(autoload 'rm-example-picture-mode-bindings "rect-mark"
"Example rect-mark key and mouse bindings for picture mode.")
;; time-stamp, 在文件头记录修改时间, 并动态更新
(require 'time-stamp-settings)
;; 显示ascii表
(require 'ascii)