2024-02-15 08:18:41 +00:00
|
|
|
#+title: IDE Config
|
|
|
|
#+author: Evie Litherland-Smith
|
|
|
|
#+email: evie@xenia.me.uk
|
|
|
|
#+filetags: :emacs:config:org:
|
2024-02-15 08:45:37 +00:00
|
|
|
#+property: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent
|
2024-02-15 12:01:36 +00:00
|
|
|
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:hook (prog-mode))
|
|
|
|
|
|
|
|
(use-package direnv
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:custom (direnv-always-show-summary nil)
|
|
|
|
:config (direnv-mode +1))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Grand Unified Debugger
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(with-eval-after-load 'gud
|
|
|
|
(customize-set-variable 'gdb-many-windows t))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Tree-sitter
|
2024-02-15 08:18:41 +00:00
|
|
|
Set treesit to fontify all elements, default was 3 (out of 4)
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package treesit
|
|
|
|
:diminish
|
|
|
|
:custom
|
|
|
|
(treesit-font-lock-level 3))
|
|
|
|
|
|
|
|
(use-package treesit-auto
|
|
|
|
:diminish
|
|
|
|
:after (treesit)
|
|
|
|
:config
|
|
|
|
(treesit-auto-add-to-auto-mode-alist)
|
|
|
|
(global-treesit-auto-mode +1))
|
|
|
|
|
|
|
|
(with-eval-after-load 'rust-mode
|
|
|
|
(setq rust-ts-mode-hook rust-mode-hook))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Eldoc
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(use-package eldoc
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:custom
|
|
|
|
(eldoc-echo-area-display-truncation-message nil)
|
|
|
|
(eldoc-echo-area-prefer-doc-buffer t)
|
|
|
|
(eldoc-echo-area-use-multiline-p nil))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Eglot LSP
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package eglot
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:demand
|
|
|
|
:bind (("C-c c e" . eglot)
|
|
|
|
("C-c c C-e" . eglot-reconnect)
|
|
|
|
("C-c c a" . eglot-code-actions)
|
|
|
|
("C-c c r" . eglot-rename))
|
2024-02-21 06:43:58 +00:00
|
|
|
:hook (((nix-mode
|
|
|
|
python-base-mode
|
2024-02-20 09:41:40 +00:00
|
|
|
rust-ts-mode
|
2024-02-15 08:18:41 +00:00
|
|
|
fortran-mode
|
|
|
|
f90-mode
|
2024-02-16 17:00:51 +00:00
|
|
|
js-ts-mode)
|
|
|
|
. eglot-ensure)
|
2024-02-15 08:18:41 +00:00
|
|
|
(eglot-managed-mode . (lambda () (add-to-list 'flymake-diagnostic-functions #'eglot-flymake-backend))))
|
|
|
|
:custom
|
|
|
|
(eglot-extend-to-xref t)
|
|
|
|
(eglot-autoshutdown t)
|
|
|
|
(eglot-autoreconnect nil)
|
|
|
|
:config
|
|
|
|
(setq eglot-stay-out-of '(flymake))
|
2024-02-16 16:55:48 +00:00
|
|
|
(setq-default eglot-workspace-configuration
|
|
|
|
'( :pylsp
|
|
|
|
( :plugins
|
|
|
|
( :jedi_completion
|
|
|
|
( :enabled t
|
|
|
|
:include_params t
|
|
|
|
:include_class_objects t
|
|
|
|
:include_function_objects t
|
|
|
|
:fuzzy t)
|
|
|
|
:jedi_definition (:enabled t)
|
|
|
|
:jedi_hover (:enabled t))))))
|
2024-02-15 08:18:41 +00:00
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Apheleia formatting
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package apheleia
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:bind (("C-c c f" . apheleia-format-buffer))
|
|
|
|
:hook (prog-mode)
|
|
|
|
:custom (apheleia-remote-algorithm 'local)
|
|
|
|
:config
|
|
|
|
(add-to-list 'apheleia-formatters '(alejandra . ("alejandra")))
|
|
|
|
(add-to-list 'apheleia-mode-alist '(nix-mode . alejandra))
|
|
|
|
(add-to-list 'apheleia-mode-alist '(python-ts-mode . ruff))
|
|
|
|
(add-to-list 'apheleia-mode-alist '(python-mode . ruff)))
|
|
|
|
#+end_src
|
2024-02-15 12:01:36 +00:00
|
|
|
* Flymake
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(use-package flymake
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c C-." . flymake-goto-next-error)
|
|
|
|
("C-c C-," . flymake-goto-prev-error))
|
2024-02-16 16:55:48 +00:00
|
|
|
:hook (prog-mode . flymake-mode)
|
|
|
|
:config (require 'flymake-collection))
|
2024-02-15 08:18:41 +00:00
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** Diagnostics in popup
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(use-package flymake-popon
|
|
|
|
:ensure t
|
|
|
|
:after flymake
|
|
|
|
:diminish
|
|
|
|
:config
|
|
|
|
(global-flymake-popon-mode +1))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-16 16:55:48 +00:00
|
|
|
** flymake-collection
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package flymake-collection
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:defer
|
|
|
|
:after flymake)
|
|
|
|
|
|
|
|
(with-eval-after-load 'python
|
|
|
|
(add-hook 'python-base-mode-hook
|
|
|
|
(defun python-mode-setup-flymake ()
|
|
|
|
(add-hook 'flymake-diagnostic-functions 'flymake-collection-mypy nil t))))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** shellcheck
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package flymake-shellcheck
|
|
|
|
:ensure t
|
|
|
|
:after flymake
|
|
|
|
:diminish
|
|
|
|
:hook (sh-mode . flymake-shellcheck-load))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-16 16:55:48 +00:00
|
|
|
** clippy
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package flymake-clippy
|
|
|
|
:ensure t
|
|
|
|
:after flymake
|
|
|
|
:diminish
|
|
|
|
:hook ((rust-mode rust-ts-mode) . flymake-clippy-setup-backend))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** eslint
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package flymake-eslint
|
|
|
|
:ensure t
|
|
|
|
:after flymake
|
|
|
|
:diminish
|
|
|
|
:hook (js-ts-mode . flymake-eslint-enable))
|
|
|
|
#+end_src
|
2024-02-16 14:26:11 +00:00
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** ruff
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package flymake-ruff
|
|
|
|
:ensure t
|
2024-02-16 16:55:48 +00:00
|
|
|
:after flymake
|
2024-02-15 08:18:41 +00:00
|
|
|
:diminish
|
|
|
|
:hook (python-base-mode . flymake-ruff-load))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Project
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(setq project-switch-use-entire-map t
|
|
|
|
project-switch-commands '((project-find-file "Find file")
|
|
|
|
(project-find-regexp "Find regexp")
|
|
|
|
(project-find-dir "Find directory")
|
2024-02-16 14:26:11 +00:00
|
|
|
(project-eshell "Eshell")
|
|
|
|
(magit-project-status "Magit")))
|
2024-02-15 08:18:41 +00:00
|
|
|
#+end_src
|
2024-02-15 12:01:36 +00:00
|
|
|
* Version control
|
|
|
|
** Magit
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package magit
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:bind (("C-c g g" . magit-status)
|
|
|
|
("C-c g d" . magit-dispatch)
|
|
|
|
("C-c g f" . magit-file-dispatch)
|
|
|
|
("C-c g p" . magit-pull)
|
|
|
|
("C-c g P" . magit-push)
|
|
|
|
("<remap> <project-vc-dir" . magit-project-status)
|
|
|
|
:map project-prefix-map
|
|
|
|
("m" . magit-project-status))
|
|
|
|
:custom
|
|
|
|
(magit-display-buffer-function 'magit-display-buffer-same-window-except-diff-v1)
|
|
|
|
(magit-define-global-key-bindings nil)
|
|
|
|
(magit-clone-default-directory "~/Projects/")
|
|
|
|
(magit-clone-set-remote.pushDefault t)
|
|
|
|
(magit-commit-show-diff nil)
|
|
|
|
(magit-commit-diff-inhibit-same-window t)
|
|
|
|
(magit-diff-adjust-tab-width t)
|
|
|
|
(magit-diff-refine-hunk 'all)
|
|
|
|
(magit-diff-refine-ignore-whitespace t)
|
|
|
|
(magit-clone-name-alist '(("\\`\\(?:github:\\|gh:\\)?\\([^:]+\\)\\'" "github.com" "github.user")
|
|
|
|
("\\`\\(?:gitlab:\\|gl:\\)\\([^:]+\\)\\'" "gitlab.com" "gitlab.user")
|
|
|
|
("\\`\\(?:sourcehut:\\|sh:\\)\\([^:]+\\)\\'" "git.sr.ht" "sourcehut.user")
|
|
|
|
("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user"))))
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
* Aggressive Indent
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package aggressive-indent
|
|
|
|
:ensure t
|
|
|
|
:diminish
|
|
|
|
:hook (elisp-mode
|
|
|
|
lisp-mode
|
|
|
|
lisp-data-mode
|
|
|
|
rust-mode))
|
|
|
|
#+end_src
|
2024-02-15 12:01:36 +00:00
|
|
|
* Language-specific settings
|
|
|
|
** Nix
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package nix-mode
|
|
|
|
:mode "\\.nix\\'"
|
|
|
|
:config
|
|
|
|
(require 'nix)
|
2024-02-20 09:41:40 +00:00
|
|
|
(require 'nix-flake)
|
|
|
|
(require 'nix-repl)
|
|
|
|
(require 'nix-store)
|
|
|
|
(nix-prettify-global-mode +1))
|
2024-02-15 08:18:41 +00:00
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** Nushell
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package nushell-ts-mode
|
|
|
|
:mode "\\.nu\\'")
|
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** Python
|
2024-02-15 08:18:41 +00:00
|
|
|
Set fill column to 88 and enable display in python buffers
|
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(defun my/enable-fill-column (col)
|
|
|
|
"Set and enable fill column"
|
|
|
|
(set-fill-column col)
|
|
|
|
(display-fill-column-indicator-mode +1))
|
|
|
|
|
|
|
|
(use-package python
|
|
|
|
:defer t
|
|
|
|
:custom
|
2024-02-16 16:55:48 +00:00
|
|
|
(python-check-command (cond ((executable-find "ruff")
|
|
|
|
"ruff check --output-format=pylint")
|
|
|
|
((executable-find "pyflakes")
|
|
|
|
"pyflakes")
|
|
|
|
((executable-find "epylint")
|
|
|
|
"epylint")
|
|
|
|
(t "pyflakes")))
|
2024-02-15 08:18:41 +00:00
|
|
|
:config
|
2024-02-16 16:55:48 +00:00
|
|
|
(setq python-ts-mode-hook python-mode-hook)
|
|
|
|
(add-hook 'python-base-mode-hook (lambda () (my/enable-fill-column 88))))
|
2024-02-15 08:18:41 +00:00
|
|
|
#+end_src
|
|
|
|
|
2024-02-15 12:01:36 +00:00
|
|
|
** Rust
|
2024-02-15 08:18:41 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package cargo
|
|
|
|
:hook (rust-ts-mode . cargo-minor-mode))
|
|
|
|
#+end_src
|