-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcc-prog-mode.el
73 lines (59 loc) · 2.31 KB
/
cc-prog-mode.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
66
67
68
69
70
71
72
73
;;; cc-prog-mode.el --- Programming Customizations -*- lexical-binding: t; -*-
;; Copyright (C) 2023-2024 Charles Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
(require 'prog-mode)
(require 'make-mode)
(require 'mouse)
(require 'elec-pair)
(require 'company)
(require 'cc-save-hooks)
(require 'rainbow-mode)
(require 'display-line-numbers)
(require 'display-fill-column-indicator)
(require 'hl-line)
(require 'gud)
(require 'flyspell)
(require 'compile)
(require 'imenu)
(require 'cc-main-tmenu)
;;; Code:
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'prog-mode-hook 'electric-pair-mode)
(add-hook 'prog-mode-hook 'company-mode)
(add-hook 'prog-mode-hook 'context-menu-mode)
(add-hook 'prog-mode-hook 'rainbow-mode)
(add-hook 'prog-mode-hook 'display-fill-column-indicator-mode)
(add-hook 'prog-mode-hook 'hl-line-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
(add-hook 'prog-mode-hook #'cc/save-hook-delete-trailing-whitespace)
(add-hook 'prog-mode-hook #'imenu-add-menubar-index)
(define-key prog-mode-map [remap indent-for-tab-command]
#'company-indent-or-complete-common)
(keymap-set prog-mode-map "C-a" #'back-to-indentation)
(keymap-set prog-mode-map "C-6" #'imenu)
(keymap-set compilation-mode-map "C-o" #'cc/main-tmenu)
;; GUD - mode preferences
;; (setq gud-mode-hook
;; '((lambda ()
;; (local-set-key [f7] 'gud-step)
;; (local-set-key [f8] 'gud-next)
;; (local-set-key [f9] 'gud-cont))))
;; # Makefile
(keymap-set makefile-mode-map "<f9>" #'compile)
(keymap-set makefile-mode-map "C-6" #'imenu)
(add-hook 'makefile-mode-hook #'imenu-add-menubar-index)
(provide 'cc-prog-mode)
;;; cc-prog-mode.el ends here