dotfiles/emacs/.emacs.d/config/init-ide.el

76 lines
2.0 KiB
EmacsLisp

;; -*- lexical-binding: t; -*-
;; IDE features
;; Company-mode provides inline autocompletion
(use-package company
:hook (after-init . global-company-mode)
:config
(setq tab-always-indent 'complete)
(evil-collection-company-setup)
(general-def company-active-map "RET" #'company-complete-selection)
:custom
(company-idle-delay 0.3)
:general
([remap indent-for-tab-command] #'company-indent-or-complete-common)
([remap c-indent-line-or-region] #'company-indent-or-complete-common))
;; Flycheck gives you error squigglies
(use-package flycheck
:hook (after-init . global-flycheck-mode)
:custom
(flycheck-disabled-checkers '(emacs-lisp-checkdoc emacs-lisp)))
;; Quick file overview for supported modes
(use-package imenu
:straight (:type built-in)
:general
(leader-map "m" #'imenu))
;; Find definition/references
(use-package xref
:straight (:type built-in)
:config
(evil-collection-xref-setup)
:general
(normal "M-," #'xref-pop-marker-stack)
(normal "M-r" #'xref-find-references)
:custom
(xref-prompt-for-identifier nil))
(use-package eglot
:commands (eglot)
:hook
(java-mode . eglot-ensure)
(rust-mode . eglot-ensure)
(js-mode . eglot-ensure)
(typescript-mode . eglot-ensure)
(python-mode . eglot-ensure))
;; Some compilation-mode conveniences
(use-package compile
:straight (:type built-in)
:commands compile
:config
(evil-collection-compile-setup)
(defun postprocess-compilation-buffer ()
(goto-char compilation-filter-start)
(when (looking-at "\033c")
(delete-region (point-min) (match-end 0)))
(ansi-color-apply-on-region (point) (point-max)))
(add-hook 'compilation-filter-hook 'postprocess-compilation-buffer))
;; Code formatting library
(use-package apheleia
:straight (apheleia :host github :repo "raxod502/apheleia")
:general
("C-c f" #'apheleia-format-buffer))
;; Debugger interface
(use-package realgud
:defer t
:config
(evil-collection-realgud-setup))
(provide 'init-ide)