emacs cedet


(require 'package)
  (package-initialize)
  (add-to-list'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (highlight-symbol ggtags auto-complete))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(require 'auto-complete-config)
(ac-config-default)

(setq make-backup-files nil)

(require 'highlight-symbol)
(global-set-key [(control f3)] 'highlight-symbol)
(global-set-key [f3] 'highlight-symbol-next)
(global-set-key [(shift f3)] 'highlight-symbol-prev)
(global-set-key [(meta f3)] 'highlight-symbol-query-replace)


(require 'cedet)
(semantic-mode 1)

(custom-set-variables
'(semantic-default-submodes (quote (global-semantic-decoration-mode global-semantic-idle-completions-mode
global-semantic-idle-scheduler-mode global-semanticdb-minor-mode
global-semantic-idle-summary-mode global-semantic-mru-bookmark-mode)))
'(semantic-idle-scheduler-idle-time 3))

;; smart complitions
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(setq-mode-local c-mode semanticdb-find-default-throttle
'(project unloaded system recursive))
(setq-mode-local c++-mode semanticdb-find-default-throttle
         '(project unloaded system recursive))
;;;; TAGS Menu
(defun my-semantic-hook ()
(imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)

;;;; Semantic DataBase存储位置
(setq semanticdb-default-save-directory
      (expand-file-name "~/.emacs.d/semanticdb"))

(require 'semantic/db-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)

;; 使用 gnu global 的TAGS。
(require 'semantic/db-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)


;;;; 缩进或者补齐
;;; hippie-try-expand settings
;;(setq hippie-expand-try-functions-list
;;'(
;;;;yas/hippie-try-expand
;;semantic-ia-complete-symbol
;;try-expand-dabbrev
;;try-expand-dabbrev-visible
;;try-expand-dabbrev-all-buffers
;;try-expand-dabbrev-from-kill
;;try-complete-file-name-partially
;;try-complete-file-name
;;try-expand-all-abbrevs))


;;(defun indent-or-complete ()
;;"Complete if point is at end of a word, otherwise indent line."
;;(interactive)
;;(if (looking-at "\\>")
;;(hippie-expand nil)
;;(indent-for-tab-command)
;;))

(defun yyc/indent-key-setup ()
"Set tab as key for indent-or-complete"
;;(local-set-key [(tab)] 'indent-or-complete)
)

;;;; C-mode-hooks .
(defun yyc/c-mode-keys ()
"description"
;; Semantic functions.
(semantic-default-c-setup)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-cb" 'semantic-mrub-switch-tags)
(local-set-key "\C-cR" 'semantic-symref)
(local-set-key "\C-cj" 'semantic-ia-fast-jump)
(local-set-key "\C-cp" 'semantic-ia-show-summary)
(local-set-key "\C-cl" 'semantic-ia-show-doc)
(local-set-key "\C-cr" 'semantic-symref-symbol)
(local-set-key "\C-c/" 'semantic-ia-complete-symbol)
(local-set-key [(control return)] 'semantic-ia-complete-symbol)
(local-set-key "." 'semantic-complete-self-insert)
(local-set-key ">" 'semantic-complete-self-insert)
;; Indent or complete
;;(local-set-key [(tab)] 'indent-or-complete)
)
(add-hook 'c-mode-common-hook 'yyc/c-mode-keys)
上一篇:hadoop+spark集群搭建入门


下一篇:Docker学习笔记:在Windows7下安装