emacs for wsl

;;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.
 )
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值