elisp/c-init.el
author Luke Hoersten <luke@hoersten.org>
Thu, 02 Oct 2025 09:50:40 -0500
changeset 105 e45e60614994
parent 71 b5976ed7311a
permissions -rw-r--r--
Moved from ido and smex to vertico, orderless, consult, marginalia for auto complete. Packages updated: - Removed: flx-ido, smex - Added: vertico, orderless, consult, marginalia Configuration changes: - vertico-mode replaces ido-mode for completion UI - orderless provides fuzzy matching (replaces flx-ido) - marginalia-mode adds helpful annotations - consult-buffer replaces default buffer switching (better than ido) - consult-ripgrep replaces plain rg command (adds preview) - consult-yank-pop on M-y (enhanced kill-ring browsing) Your keybindings: - M-x now uses vertico (no special binding needed) - C-x b → consult-buffer (enhanced) - C-c g → consult-ripgrep (with live preview) - M-y → consult-yank-pop (browse kill ring) Please enter the commit message for your changes. Lines starting

;; ~/.emacs.d/c-hook.el
;; Luke Hoersten <[email protected]>

(require 'hoersten-c-style)

(add-hook
 'c-mode-common-hook
 (lambda ()
   ;; indentation
   (setq
    tab-width 3
    c-basic-offset 3
    indent-tabs-mode t
    standard-indent 3
    whitespace-line-column 120)

   (setq
    compile-command "scons "
    c-hungry-delete-key t)

   (c-toggle-auto-newline t) ; auto newline
   (c-subword-mode t)

   ;; custom keys
   (local-set-key (kbd "C-c f")   'ff-find-other-file) ; toggle header/source file

   ;; ;; code folding
   ;; (local-set-key (kbd "C-c v") 'hs-toggle-hiding)
   ;; (local-set-key (kbd "<f1>")  'hs-hide-all)
   ;; (local-set-key (kbd "<f2>")  'hs-show-all)
   ;; (hs-minor-mode t) ; enable hide-show mode

   ;; gdb settings
   (setq
    gdb-many-windows t                ; gdb many windows
    gdb-use-separate-io-buffer t      ; gdb stdio output
    gud-tooltip-mode t)               ; mouse hover variables
   (local-set-key (kbd "C-c g") 'gdb) ; gdb

   ;; auto-close bracing
   (setq parens-require-spaces nil)
   (dolist (key '("(" "[")) (define-key (current-local-map) key 'insert-pair))
   ))

(add-to-list 'auto-mode-alist '("\\.ipp$" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))

(message "Loading c-init...done")
(provide 'c-init)