Add Clojure, Python, Terraform, and YAML config

This commit is contained in:
Jeremy Dormitzer 2021-02-20 22:01:34 -05:00
parent 68e30e2455
commit c3fc728d98
5 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,50 @@
;; -*- lexical-binding: t; -*-
;; Clojure configuration
(use-package clojure-mode
:mode (("\\.clj\\'" . clojure-mode)
("\\.cljs\\'" . clojurescript-mode)
("\\.cljc\\'" . clojurec-mode)
("\\.edn\\'" . clojure-mode))
:config
(define-clojure-indent
(defroutes 'defun)
(GET 2)
(POST 2)
(PUT 2)
(DELETE 2)
(HEAD 2)
(ANY 2)
(OPTIONS 2)
(PATCH 2)
(rfn 2)
(let-routes 1)
(context 2)
(:= 3)
(:+ 3)
(match 1)
(for-all 2)
(checking 2)
(let-flow 1)))
;; Flycheck support
(use-package flycheck-clj-kondo
:after (clojure-mode)
:if (executable-find "clj-kondo"))
(use-package cider
:commands (cider-mode cider-jack-in cider-jack-in-clojurescript)
:custom
(cider-known-endpoints
'(("local" "localhost" "4005")))
(cider-prompt-for-symbol nil)
(general-def cider-mode-map "C-c t" cider-test-commands-map)
:hook ((clojure-mode . cider-mode)
(clojurescript-mode . cider-mode)
(clojurec-mode . cider-mode))
:general
(cider-stacktrace-mode-map "SPC" leader-map)
('normal cider-mode-map "M-." #'cider-find-var)
(cider-repl-mode-map "C-c C-l" #'cider-repl-clear-buffer))
(provide 'init-clojure)

View File

@ -0,0 +1,54 @@
;; -*- lexical-binding: t; -*-
;; Python configuration
(use-package python
:defer t
:straight (:type built-in)
:config
;; Redefine the python-mypy flycheck checker to account for projectile-compilation-dir
(flycheck-define-checker python-mypy
"Mypy syntax and type checker. Requires mypy>=0.580.
See URL `http://mypy-lang.org/'."
:command ("mypy"
"--show-column-numbers"
(config-file "--config-file" flycheck-python-mypy-config)
(option "--cache-dir" flycheck-python-mypy-cache-dir)
source-original)
:error-patterns
((error line-start (file-name) ":" line (optional ":" column)
": error:" (message) line-end)
(warning line-start (file-name) ":" line (optional ":" column)
": warning:" (message) line-end)
(info line-start (file-name) ":" line (optional ":" column)
": note:" (message) line-end))
:modes python-mode
;; Ensure the file is saved, to work around
;; https://github.com/python/mypy/issues/4746.
:predicate flycheck-buffer-saved-p
:working-directory (lambda (checker)
(or (projectile-compilation-dir)
default-directory))))
;; pyvenv to track virtual environments
(use-package pyvenv
:defer 3
:config
(pyvenv-mode)
(pyvenv-tracking-mode))
;; pyenv to track Python version
(use-package pyenv-mode
:defer t)
;; LSP using Microsoft's pyright language server
(use-package lsp-pyright
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred)))
:custom
(lsp-pyright-use-library-code-for-types t)
:general
(python-mode-map "C-c C-d" #'lsp-describe-thing-at-point))
(provide 'init-python)

View File

@ -0,0 +1,7 @@
;; -*- lexical-binding: t; -*-
;; Configuration as code!
(use-package terraform-mode
:mode "\\.tf\\'")
(provide 'init-terraform)

View File

@ -0,0 +1,9 @@
;; -*- lexical-binding: t; -*-
;; YAML - literally the worst but still holds an important place in my life
(use-package yaml-mode
:mode ("\\.yaml\\'" "\\.yml\\'")
:config
(add-hook 'yaml-mode-hook #'highlight-indent-guides-mode))
(provide 'init-yaml)

View File

@ -70,6 +70,10 @@
(require 'init-ide)
(require 'init-eshell)
(require 'init-help)
(require 'init-python)
(require 'init-clojure)
(require 'init-yaml)
(require 'init-terraform)
;; Load the custom file
(when (file-exists-p custom-file)