Some cleanup and set formatters for python/yaml

This commit is contained in:
exu 2025-03-13 14:58:29 +01:00
parent c99dedec0a
commit e4d7e23380
2 changed files with 12 additions and 25 deletions
roles/config/files/.config/doom

View File

@ -97,35 +97,17 @@
;; enable case insensitive matching for 'auto-mode-alist'
;; see https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html
;; disabled by doom-start.el
;; (setq auto-mode-case-fold t)
(setq auto-mode-case-fold t)
;; work around emacs hanging when opening any python requirements.txt file
;; see issue https://github.com/doomemacs/doomemacs/issues/5998
;; (advice-add #'pip-requirements-fetch-packages :override #'ignore)
;; Enable nimlangserver for nim files
;; (add-hook 'nim-mode-hook #'lsp)
;; Disable formatter for php
;; (setq-hook! 'php-mode-hook +format-with :none)
;; auto-virtualenv package configuration
;; (use-package! auto-virtualenv
;; :init
;; :config
;; (add-hook! 'python-mode-hook 'auto-virtualenv-set-virtualenv)
;; (add-hook! 'projectile-after-switch-project-hook 'auto-virtualenv-set-virtualenv) ;; If using projectile
;; )
(use-package! auto-virtualenv
:config
(setq auto-virtualenv-verbose t)
(auto-virtualenv-setup))
;; python debugging
;; (after! dap-mode
;; (setq dap-python-debugger 'debugpy))
;; justfile recipe execution
(use-package! justl
:config
@ -213,8 +195,13 @@
;; gleam
(set-eglot-client! 'gleam-ts-mode '("gleam" "lsp"))
;; Use default included python formatter
(setq-hook! 'python-mode-hook +format-with nil)
;; python hook use ruff as formatter (disable lsp format)
(setq-hook! 'python-mode-hook +format-with 'ruff)
;; Use default included yaml formatter
(setq-hook! 'yaml-mode-hook +format-with nil)
;; yaml hook use prettier-yaml as formatter (disable lsp format)
(setq-hook! 'yaml-mode-hook +format-with 'prettier-yaml)
;; terraform/tofu files formatter
(after! terraform-mode
(set-formatter! 'tofu'("terraform" "fmt" "-") :modes '(terraform-mode)))
(setq-hook! 'terraform-mode-hook +format-with 'tofu)

View File

@ -56,7 +56,7 @@
(evil +everywhere); come to the dark side, we have cookies
;;file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(format +onsave) ; automated prettiness
(format +onsave +lsp) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
@ -102,7 +102,7 @@
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
(terraform +lsp) ; infrastructure as code
(terraform) ; infrastructure as code
;;tmux ; an API for interacting with tmux
tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp