Simplify and add emacs config

This commit is contained in:
2025-09-26 17:51:52 -04:00
parent 4f38297378
commit 93aecdd5cb
13 changed files with 2334 additions and 0 deletions

27
xdg/emacs/modes/c-mode.el Normal file
View File

@ -0,0 +1,27 @@
;; New Keybindings
(define-key c-mode-base-map (kbd "<f11>") 'compile)
(define-key c-mode-base-map "\C-c\C-c" 'compile)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
(define-key c-mode-base-map (kbd "C-c SPC") 'hs-toggle-hiding)
;; Syntax hilighting
(setq c-default-style "stroustrup")
;; Bury the compile buffer when finished compiling. Function in lisp/functions.el
(add-hook 'compilation-finish-functions 'bury-compile-buffer-if-successful)
;; Define Tab width
(setq truncate-lines 1)
(setq tab-width 4)
(setq indent-tabs-mode nil)
;; Make backspace and C-d delete whitespace
(c-toggle-hungry-state t)
;; When using a new enough version of emacs, use many gdb windows.
(when (or (> emacs-major-version 23)
(and (= emacs-major-version 23)
(>= emacs-minor-version 2)))
;; Use the GDB visual debugging moden
(setq gdb-many-windows t)
)

View File

@ -0,0 +1,7 @@
;; Bury the compile buffer when finished compiling. Function in lisp/functions.el
(add-hook 'compilation-finish-functions 'bury-compile-buffer-if-successful)
(add-hook 'before-save-hook #'gofmt-before-save)
;; Define Tab width
(setq truncate-lines t)

View File

@ -0,0 +1,13 @@
; Hooks to enable custom modes
(add-to-list 'auto-mode-alist '("\\.cu\\'" . c++-mode))
; Settings for Text mode
(add-hook 'text-mode-hook 'auto-fill-mode)
(add-hook 'text-mode-hook 'flyspell-mode)
; Settings for C++ mode (and I guess C as well)
(add-hook 'c-mode-common-hook (lambda () (load "~/.emacs.d/modes/c-mode.el")))
(add-hook 'c-mode-common-hook 'hs-minor-mode)
;; Terraform mode hooks
(add-hook 'terraform-mode-hook 'terraform-format-on-save-mode)