whompmacs/whomp/whomp-development.el

143 lines
4.7 KiB
EmacsLisp
Raw Normal View History

;;
;; development assistance packages
;;
;; dev layer toggles
2024-07-12 23:32:01 +00:00
(defcustom whomp-development nil
"Whether or not to enable development assistance packages."
:type '(set (const :tag "None" nil)
(const :tag "lsp" lspmode) ;; generally required for other modes
(const :tag "magit" magitmode) ;; git integration
(const :tag "projectile" projectilemode) ;; project management
(const :tag "go" gomode) ;; go language support
(const :tag "python" pythonmode) ;; python language support
(const :tag "elpy" elpymode) ;; python language support (elpy)
(const :tag "yaml" yamlmode) ;; yaml language support
(const :tag "rainbow-delimiters" rainbowmode) ;; rainbow-delimiters support
2024-07-13 18:35:50 +00:00
(const :tag "terraform" terraformmode) ;; terraform language support
(const :tag "z80" z80mode) ;; z80 assembly language support
2024-07-17 17:32:13 +00:00
(const :tag "typescript" typescriptmode) ;; typescript language support
)
2024-07-12 23:32:01 +00:00
:group 'whomp-config)
2024-07-13 18:35:50 +00:00
;; terraform-mode
(when (memq 'terraformmode whomp-development)
(use-package terraform-mode
:straight t
:defer t)
(when (eq 'company whomp-completion)
(use-package company-terraform
:straight t
:defer t
:config
(add-hook 'terraform-mode-hook #'company-terraform-init))
(add-hook 'terraform-mode-hook #'terraform-format-on-save-mode)
(add-hook 'terraform-mode-hook #'terraform-format-on-save-mode))
(message "terraform-mode loaded"))
;; lsp-mode
2024-07-12 23:32:01 +00:00
(when (memq 'lspmode whomp-development)
(straight-use-package 'lsp-mode)
(straight-use-package 'lsp-ui)
2024-07-12 23:32:01 +00:00
(when (eq 'treemacs whomp-dirbrowser)
(straight-use-package 'lsp-treemacs))
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024))
2024-07-12 23:32:01 +00:00
(whomp/add-key-binding "l" 'lsp-keymap-prefix "lsp-keymap-prefix")
(straight-use-package 'eglot)
(require 'eglot)
(message "lsp-mode loaded"))
;; magit
2024-07-12 23:32:01 +00:00
(when (memq 'magitmode whomp-development)
2024-07-14 09:03:59 +00:00
(use-package magit
:straight t
:defer t)
2024-07-12 23:32:01 +00:00
(whomp/add-key-binding "g s" 'magit-status "Git status (magit entrypoint)")
2024-07-14 08:23:04 +00:00
(whomp/add-key-binding "g l" 'magit-log "Git log (magit entrypoint)")
(whomp/add-key-binding "g b" 'magit-blame "Git blame (magit entrypoint)")
(whomp/add-key-binding "g f" 'magit-find-file "Git find file (magit entrypoint)")
(message "magit loaded"))
;; projectile
2024-07-12 23:32:01 +00:00
(when (memq 'projectilemode whomp-development)
(straight-use-package 'projectile)
2024-07-12 23:32:01 +00:00
(whomp/add-key-binding "p" 'projectile-command-map "Projectile commands")
(message "projectile loaded"))
;; go-mode
2024-07-12 23:32:01 +00:00
(when (memq 'gomode whomp-development)
(straight-use-package 'go-mode)
(straight-use-package 'go-eldoc)
(straight-use-package 'go-projectile)
(straight-use-package 'go-snippets)
(setq lsp-go-analyses '((shadow . t)
(simplifycompositelit . :json-false)))
(when (executable-find "gopls")
(add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'go-mode-hook 'eglot-ensure))
(when (executable-find "goimports")
(setq gofmt-command "goimports"))
(add-hook 'before-save-hook 'gofmt-before-save)
(message "go-mode loaded"))
2024-07-17 17:32:13 +00:00
;; typescript-mode
(when (memq 'typescriptmode whomp-development)
(use-package typescript-mode
:straight t
:defer t
:hook (typescript-mode-hook . turn-on-font-lock))
(message "typescript-mode loaded"))
;; python-mode
2024-07-12 23:32:01 +00:00
(when (memq 'pythonmode whomp-development)
(when (memq 'elpymode whomp-development)
(straight-use-package 'elpy)
(elpy-enable))
2024-07-12 23:32:01 +00:00
(when (not (memq 'elpymode whomp-development))
(add-hook 'python-mode-hook (lambda ()
(setq-local tab-width 2)))
(add-hook 'python-mode-hook #'lsp-deferred))
(when (executable-find "pylsp")
(add-hook 'python-mode-hook 'eglot-ensure))
(use-package python-black
:demand t
:straight t
:after python
:hook (python-mode . python-black-on-save-mode))
(message "python-mode loaded"))
;; yaml-mode
2024-07-12 23:32:01 +00:00
(when (memq 'yamlmode whomp-development)
2024-07-17 17:32:13 +00:00
(use-package yaml-mode
:straight t
:defer t)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yaml\\'" . yaml-mode))
;; yaml-mode is a bit too aggressive with its indentation
;; so we'll disable it and use the default
(add-hook 'yaml-mode-hook
(lambda ()
(setq-local electric-indent-inhibit t)
(setq-local electric-layout-rules nil)))
(message "yaml-mode loaded"))
;; rainbow-delimiters-mode
(when (memq 'rainbowmode whomp-development)
(use-package rainbow-delimiters
:straight t
:defer t
:config
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(message "rainbow-delimiters-mode loaded")))
;; z80-mode
(when (memq 'z80mode whomp-development)
(load "~/.emacs.d/whomp/z80-mode.el")
(message "z80-mode loaded"))
2024-07-12 23:32:01 +00:00
(message "W.H.O.M.P. development assistance packages loaded")
(provide 'whomp-development)
;; whomp-development.el ends here