;;color
(set-face-background 'default "black")
(set-face-foreground 'default "gray")
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(require 'yasnippet)
(yas-global-mode 1)
(ac-config-default)
(add-hook 'cmake-mode-hook (lambda () (auto-complete-mode)))
(setq ac-sources (append '(ac-source-clang ac-source-yasnippet) ac-sources))
;;cmake
;;(require 'cmake-mode)
;;(setq auto-mode-alist
;; (append
; '(("CMakeLists\\.txt\\'" . cmake-mode))
; '(("\\.cmake\\'" . cmake-mode))
; auto-mode-alist))
(require 'sr-speedbar)
(global-set-key (kbd "s-s") 'sr-speedbar-toggle)
(sr-speedbar-open)
(require 'cedet)
(global-ede-mode t)
;;enable default function
(semantic-mode 1)
;;enable semantic idle complete
(global-semantic-idle-completions-mode)
(setq semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-traditional)
;;enable semantic idle summary mode
(global-semantic-idle-summary-mode)
;;set the way of semantic search
(setq-mode-local c++-mode
semanticdb-find-default-throttle
'(file project local unloaded system recursive))
(setq-mode-local c-mode
semanticdb-find-default-throttle
'(file project local unloaded system recursive))
;;higlight fun
(global-semantic-highlight-func-mode)
;;decoration mode
(global-semantic-decoration-mode)
(setq semantic-toggle-decoration-style 'semantic-tag-boundary)
;;mru bookmark
(global-semantic-mru-bookmark-mode)
;;sticky func mode
(global-semantic-stickyfunc-mode)
;;imenu tag
(defun my-semantic-hook () (imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)
;;add c++ include
(semantic-add-system-include "/usr/include/c++/9" 'c++-mode)
(add-to-list 'auto-mode-alist (cons "/usr/include/c++" 'c++-mode))
;;;; Semantic DataBase Location
(setq semanticdb-default-save-directory
(expand-file-name "~/.emacs.d/semanticdb"))
;;;; C-mode-hooks .
(defun myc-mode-keys ()
(local-set-key "." 'semantic-complete-self-insert)
(local-set-key ">" 'semantic-complete-self-insert)
)
(defun myc-mode-toggle ()
(c-toggle-auto-newline)
;(setq c-offsets-alist '((substatement-open . 0))) ;set substatement no add space if {}
)
(add-hook 'c++-mode-hook 'myc-mode-keys)
(add-hook 'c-mode-hook 'myc-mode-keys)
(add-hook 'c++-mode-hook 'myc-mode-toggle)
(add-hook 'c-mode-hook 'myc-mode-toggle)
;setup gdb
(setq gdb-many-windows 1)
(defun mygdb-mode-hook ()
(gud-tooltip-mode)
)
(add-hook 'gdb-mode-hook 'mygdb-mode-hook)
(setq x-select-enable-clipboard 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
(sr-speedbar yasnippet-snippets auto-complete-clang-async auto-complete-clang))))
(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.
)