-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpp-settings.el
65 lines (51 loc) · 1.57 KB
/
cpp-settings.el
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(use-package cmake-mode)
(use-package cc-mode
:init
(fset 'add_block_brackets
[return ?\{ return return ?\} up tab])
:bind (:map c-mode-base-map
("C-{" . 'add_block_brackets))
)
(defun demangle-at-point ()
(interactive)
(message (shell-command-to-string (concat "c++filt _" (thing-at-point 'word))))
)
(defun insert-header-guard (guardstr)
"Insert a header guard named GUARDSTR in a c++ file."
(interactive "sHeader guard: ")
(progn
(insert "#ifndef " guardstr "\n")
(insert "#define " guardstr "\n\n")
(save-excursion
(insert "\n\n")
(insert "#endif // " guardstr))))
(defun insert-namespace (name)
"Insert a namespace"
(interactive "sNamespace name: ")
(progn
(insert "namespace " name "\n{\n ")
(save-excursion
(insert "\n} // namespace " name))))
(use-package cff
:bind (:map c-mode-base-map
("M-o" . 'cff-find-other-file)))
(defun my-next-error ()
"Jump to next error - not warning"
(interactive)
(compilation-set-skip-threshold 2)
(compilation-next-error 1)
(compilation-set-skip-threshold 1))
(defun my-previous-error ()
"Jump to next error - not warning"
(interactive)
(compilation-set-skip-threshold 2)
(compilation-next-error -1)
(compilation-set-skip-threshold 1))
(use-package compile
:bind (:map compilation-mode-map
("C-x M-n" . 'my-next-error)
("C-x M-p" . 'my-previous-error)
("c" . 'recompile)))
(use-package glsl-mode
:mode (rx (or ".vert" ".frag" ".geom" ".tesc" ".tese" ".inc")))
(provide 'cpp-settings)