Improve C++11 support
This commit is contained in:
parent
8abec3eea3
commit
b1f9683d27
1 changed files with 28 additions and 16 deletions
|
@ -4,14 +4,36 @@
|
||||||
c-default-style "linux"
|
c-default-style "linux"
|
||||||
c-tab-always-indent nil)
|
c-tab-always-indent nil)
|
||||||
|
|
||||||
|
;; Setting proper includes on OSX
|
||||||
|
(when is-mac
|
||||||
|
(setq my/clang-includes
|
||||||
|
'("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1"
|
||||||
|
"/usr/local/include"
|
||||||
|
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include"
|
||||||
|
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
|
||||||
|
"/usr/include"
|
||||||
|
"/System/Library/Frameworks"
|
||||||
|
"/Library/Frameworks"))
|
||||||
|
|
||||||
|
(after flycheck (setq flycheck-clang-include-path my/clang-includes))
|
||||||
|
(after auto-complete
|
||||||
|
(setq ac-clang-flags (mapcar (lambda (item)(concat "-I" item)) my/clang-includes)))
|
||||||
|
)
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
||||||
(add-hook! 'c-mode-common-hook
|
(add-hook! 'c-mode-common-hook
|
||||||
(use-package auto-complete-clang)
|
(use-package auto-complete-clang)
|
||||||
(use-package auto-complete-c-headers)
|
(use-package auto-complete-c-headers)
|
||||||
|
(setq ac-sources
|
||||||
|
'(ac-source-clang
|
||||||
|
ac-source-c-headers
|
||||||
|
ac-source-yasnippet
|
||||||
|
ac-source-words-in-same-mode-buffers))
|
||||||
|
|
||||||
(c-toggle-electric-state -1)
|
(c-toggle-electric-state -1)
|
||||||
(c-toggle-auto-newline -1)
|
(c-toggle-auto-newline -1)
|
||||||
|
|
||||||
|
;; DEL mapping interferes with smartparens and my.deflate-maybe
|
||||||
(defmap c-mode-map (kbd "DEL") nil)
|
(defmap c-mode-map (kbd "DEL") nil)
|
||||||
|
|
||||||
(c-set-offset 'substatement-open '0) ; brackets should be at same indentation level as the statements they open
|
(c-set-offset 'substatement-open '0) ; brackets should be at same indentation level as the statements they open
|
||||||
|
@ -20,14 +42,13 @@
|
||||||
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
|
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
|
||||||
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
||||||
|
|
||||||
(setq ac-sources
|
;; C++11 support on mac
|
||||||
'(ac-source-clang
|
(when (and is-mac (eq major-mode 'c++-mode))
|
||||||
ac-source-c-headers
|
(setq flycheck-clang-language-standard "c++11"
|
||||||
ac-source-yasnippet
|
flycheck-clang-standard-library "libc++"
|
||||||
ac-source-words-in-same-mode-buffers
|
flycheck-c/c++-clang-executable "clang++")))
|
||||||
)))
|
|
||||||
|
|
||||||
;; Implement some C++11 Support until cc-mode is updated
|
;; C++11 syntax support (until cc-mode is updated)
|
||||||
(require 'font-lock)
|
(require 'font-lock)
|
||||||
(defun --copy-face (new-face face)
|
(defun --copy-face (new-face face)
|
||||||
"Define NEW-FACE from existing FACE."
|
"Define NEW-FACE from existing FACE."
|
||||||
|
@ -41,7 +62,6 @@
|
||||||
'font-lock-doc-face)
|
'font-lock-doc-face)
|
||||||
(--copy-face 'font-lock-doc-string-face ; comment markups
|
(--copy-face 'font-lock-doc-string-face ; comment markups
|
||||||
'font-lock-comment-face)
|
'font-lock-comment-face)
|
||||||
|
|
||||||
(global-font-lock-mode t)
|
(global-font-lock-mode t)
|
||||||
(setq font-lock-maximum-decoration t)
|
(setq font-lock-maximum-decoration t)
|
||||||
|
|
||||||
|
@ -102,11 +122,3 @@
|
||||||
("\\.vert\\'" . glsl-mode)
|
("\\.vert\\'" . glsl-mode)
|
||||||
("\\.frag\\'" . glsl-mode)
|
("\\.frag\\'" . glsl-mode)
|
||||||
("\\.geom\\'" . glsl-mode)))
|
("\\.geom\\'" . glsl-mode)))
|
||||||
|
|
||||||
(define-minor-mode cocos2d-mode
|
|
||||||
"Buffer local minor mode for Cocos2D-x"
|
|
||||||
:init-value nil
|
|
||||||
:lighter " C2D"
|
|
||||||
:keymap (make-sparse-keymap))
|
|
||||||
|
|
||||||
(associate-minor-mode "[.-]c2d/" cocoa2d-mode)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue