From ba8b24b1d9fe553cf0c13297f7402ff7b79c740d Mon Sep 17 00:00:00 2001 From: Jens Luedicke Date: Fri, 12 Dec 2025 10:25:51 +0100 Subject: [PATCH] Fix keybinding conflict and remove dead Corfu code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change C-c r to C-c R for crux-rename-buffer-and-file to avoid conflict with consult-ripgrep-project-root - Remove unused corfu and cape from package list, add company instead - Remove dead Corfu/Cape integration code from init-eglot.el - Include related indentation and formatting settings cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- lisp/init-core.el | 78 +++++++++++++++++++++++++++++++++++++++++++--- lisp/init-eglot.el | 19 ++++------- lisp/init-qol.el | 7 +++-- 3 files changed, 83 insertions(+), 21 deletions(-) diff --git a/lisp/init-core.el b/lisp/init-core.el index a704a98..6e3dfc7 100644 --- a/lisp/init-core.el +++ b/lisp/init-core.el @@ -31,8 +31,7 @@ marginalia ; Rich annotations in minibuffer embark ; Contextual actions embark-consult ; Embark integration with Consult - corfu ; In-buffer completion popup - cape ; Completion extensions for Corfu + company ; In-buffer completion (configured in init-completion.el) ;; Markdown & Notes markdown-mode markdown-toc grip-mode @@ -55,14 +54,14 @@ ;; God mode for modal editing god-mode - + ;; Quality of life improvements helpful ; Better help buffers undo-tree ; Visual undo history smartparens ; Better than electric-pair-mode crux ; Collection of useful functions ace-window ; Quick window switching - + ;; Terminal emulator eat ; Emacs terminal emulator )) @@ -96,6 +95,75 @@ ;;; General Settings (setq-default indent-tabs-mode nil) (setq tab-width 4) + +;; Set standard indentation offset for all modes +(setq-default standard-indent 4) + +;; Mode-specific indentation settings (4 spaces) +(setq-default + ;; JavaScript + js-indent-level 4 + js2-basic-offset 4 + js3-indent-level 4 + + ;; TypeScript + typescript-indent-level 4 + + ;; CSS/SCSS + css-indent-offset 4 + scss-indent-offset 4 + + ;; HTML/XML + sgml-basic-offset 4 + nxml-child-indent 4 + + ;; Shell scripts + sh-basic-offset 4 + sh-indentation 4 + + ;; Lisp + lisp-indent-offset 4 + + ;; Other languages + perl-indent-level 4 + cperl-indent-level 4 + ruby-indent-level 4 + rust-indent-offset 4 + scala-indent:step 4 + coffee-tab-width 4 + lua-indent-level 4 + go-ts-mode-indent-offset 4 + + ;; C/C++ Allman style + c-basic-offset 4) + +;; C/C++ style configuration - Allman/BSD style with braces on new lines +(setq c-default-style '((c-mode . "bsd") + (c++-mode . "bsd") + (java-mode . "java") + (awk-mode . "awk") + (other . "bsd"))) + +;; Ensure C/C++ modes use Allman style +(with-eval-after-load 'cc-mode + (defun apply-c-allman-style () + "Ensure Allman style is applied to C/C++ buffers." + (c-set-style "bsd") + (setq c-basic-offset 4 + indent-tabs-mode nil)) + + (add-hook 'c-mode-hook #'apply-c-allman-style) + (add-hook 'c++-mode-hook #'apply-c-allman-style)) + +;; Web-mode indentation (for HTML/JSX/TSX files) +(with-eval-after-load 'web-mode + (setq web-mode-markup-indent-offset 4 + web-mode-css-indent-offset 4 + web-mode-code-indent-offset 4 + web-mode-attr-indent-offset 4 + web-mode-script-padding 4 + web-mode-style-padding 4)) + (setq inhibit-startup-screen t) (setq ring-bell-function 'ignore) @@ -149,4 +217,4 @@ (message "Desktop restored")))))) (provide 'init-core) -;;; init-core.el ends here \ No newline at end of file +;;; init-core.el ends here diff --git a/lisp/init-eglot.el b/lisp/init-eglot.el index 81bc482..73327ad 100644 --- a/lisp/init-eglot.el +++ b/lisp/init-eglot.el @@ -61,10 +61,10 @@ (add-to-list 'eglot-server-programs '(qml-mode . ("qmlls")))) - ;; Format on save - (defun eglot-format-buffer-on-save () - "Format buffer with eglot before saving." - (add-hook 'before-save-hook #'eglot-format-buffer -10 t)) + ;; Format on save - DISABLED to prevent reindenting + ;; (defun eglot-format-buffer-on-save () + ;; "Format buffer with eglot before saving." + ;; (add-hook 'before-save-hook #'eglot-format-buffer -10 t)) ;; Keybindings (define-key eglot-mode-map (kbd "C-c l r") 'eglot-rename) @@ -102,15 +102,8 @@ tsx-ts-mode-hook)) (add-hook mode #'eglot-ensure)) -;; Integration with Corfu for completion -(with-eval-after-load 'corfu - (setq completion-category-overrides '((eglot (styles orderless)))) - (add-hook 'eglot-managed-mode-hook - (lambda () - (setq-local completion-at-point-functions - (list (cape-super-capf - #'eglot-completion-at-point - #'cape-file)))))) +;; Integration with Company for completion (Company configured in init-completion.el) +;; Eglot automatically uses completion-at-point-functions which Company respects ;; Eldoc configuration for better documentation display (with-eval-after-load 'eldoc diff --git a/lisp/init-qol.el b/lisp/init-qol.el index 238f82d..2f68c72 100644 --- a/lisp/init-qol.el +++ b/lisp/init-qol.el @@ -88,7 +88,7 @@ ("C-c e" . crux-eval-and-replace) ("C-c w" . crux-swap-windows) ("C-c D" . crux-delete-file-and-buffer) - ("C-c r" . crux-rename-buffer-and-file) + ("C-c R" . crux-rename-buffer-and-file) ("C-c t" . crux-visit-term-buffer) ("C-c k" . crux-kill-other-buffers) ("C-c TAB" . crux-indent-rigidly-and-copy-to-clipboard) @@ -110,8 +110,9 @@ ([remap kill-whole-line] . crux-kill-whole-line) ([remap kill-line] . crux-smart-kill-line)) :config - ;; Use crux cleanup on save for programming modes - (add-hook 'before-save-hook 'crux-cleanup-buffer-or-region)) + ;; Use crux cleanup on save for programming modes - DISABLED to prevent reindenting + ;; (add-hook 'before-save-hook 'crux-cleanup-buffer-or-region) + ) ;;; Ace-window - Quick window switching (use-package ace-window