-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcpp-config.el
More file actions
48 lines (40 loc) · 1.47 KB
/
cpp-config.el
File metadata and controls
48 lines (40 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;; -*- mode: emacs-lisp -*-
;;; Code: C/C++ customisations
;; associate arduino sketches to c-mode
(add-to-list 'auto-mode-alist (cons "\\.ino\\'" 'c-mode))
;; force `c++-mode' for `*.h' header files
(add-to-list 'auto-mode-alist (cons "\\.h\\'" 'c++-mode))
;; and CUDA source & header files to c++-mode
(add-to-list 'auto-mode-alist (cons "\\.cuh?\\'" 'c++-mode))
;; flycheck
(add-hook 'c++-mode-hook #'lsp-deferred)
(add-hook 'c++-mode-hook
(lambda ()
;; NOTE: *-language-standard: when set globally, breaks C mode
(setq flycheck-clang-language-standard "c++17"
flycheck-gcc-language-standard "c++17"
)))
;; format on save
(require 'clang-format-lite)
(add-hook 'c++-mode-hook #'clang-format-lite-save-hook)
(add-hook 'c-mode-hook #'clang-format-lite-save-hook)
;;; Keybindings
;; TODO: isearch through symbol names
;; rebind as c-electric overrides global binding
(add-hook 'c-mode-common-hook
(lambda ()
(flycheck-mode 1)
;; want auto indentation more than parenthesis pairing
;; however, is there a way to have my cake and eat it too?
(local-set-key "(" 'skeleton-pair-insert-maybe)
(local-set-key "{" 'skeleton-pair-insert-maybe)
(local-set-key "[" 'skeleton-pair-insert-maybe)
(local-set-key (kbd "M-RET") 'newline-and-indent)
;; (c-toggle-auto-newline 1)
(yas-minor-mode 1)
))
(require 'dap-lldb)
;;; cpp-config.el ends here
;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp emacs-lisp-checkdoc)
;; End: