2022-06-06 05:41:10 +02:00
|
|
|
;;; modes.el --- Various modes
|
|
|
|
;;; Commentary:
|
|
|
|
;;; This file contains various Emacs modes that I use.
|
|
|
|
;;; Code:
|
|
|
|
(require 'lsp-mode)
|
2022-06-13 02:43:01 +02:00
|
|
|
(require 'flycheck)
|
2022-06-06 05:41:10 +02:00
|
|
|
;; Language modes + configurations
|
2022-06-08 16:11:39 +02:00
|
|
|
(require 'eglot)
|
2022-06-06 05:41:10 +02:00
|
|
|
(use-package typescript-mode
|
|
|
|
:mode
|
|
|
|
("\\.tsx?\\'" . typescript-mode)
|
|
|
|
:config
|
|
|
|
(setq typescript-indent-level 2))
|
|
|
|
|
|
|
|
(use-package clojure-mode
|
|
|
|
:mode
|
|
|
|
("\\.cljs?\\'" . clojure-mode)
|
|
|
|
:hook
|
|
|
|
(clojure-mode . lsp-deferred))
|
|
|
|
|
|
|
|
(use-package go-mode
|
|
|
|
:mode
|
|
|
|
("\\.go\\'" . go-mode)
|
|
|
|
:hook
|
|
|
|
(go-mode . lsp-deferred))
|
|
|
|
|
|
|
|
(use-package markdown-mode
|
|
|
|
:mode
|
|
|
|
("\\.md\\'" . markdown-mode)
|
|
|
|
:hook
|
|
|
|
(markdown-mode . auto-fill-mode))
|
|
|
|
|
|
|
|
;; Java/Meghanada
|
|
|
|
(use-package meghanada)
|
|
|
|
(add-hook 'java-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(meghanada-mode t)
|
|
|
|
(setq c-basic-offset 2)
|
|
|
|
(add-hook 'before-save-hook 'meghanada-code-beautify-before-save)))
|
|
|
|
(setq meghanada-java-path "java")
|
|
|
|
(setq meghanada-maven-path "mvn")
|
|
|
|
|
|
|
|
;; No config modes
|
|
|
|
(use-package json-mode)
|
|
|
|
(use-package yaml-mode)
|
2022-06-13 02:43:01 +02:00
|
|
|
(use-package d-mode)
|
2022-06-06 05:41:10 +02:00
|
|
|
|
2022-06-08 16:11:39 +02:00
|
|
|
;; eglot mode hooks
|
2022-06-13 02:43:01 +02:00
|
|
|
(add-to-list 'eglot-server-programs
|
|
|
|
`(c-mode . ("clangd" "--include" "/usr/include/")))
|
|
|
|
(add-to-list 'eglot-server-programs
|
|
|
|
`(c++-mode . ("clangd" "--include" "/usr/include/")))
|
2022-06-08 16:11:39 +02:00
|
|
|
(add-hook 'c-mode-hook 'eglot-ensure)
|
|
|
|
(add-hook 'c++-mode-hook 'eglot-ensure)
|
2022-06-13 02:43:01 +02:00
|
|
|
(add-hook 'd-mode-hook 'eglot-ensure)
|
2022-06-08 16:11:39 +02:00
|
|
|
(add-hook 'typescript-mode 'eglot-ensure)
|
|
|
|
(add-hook 'go-mode 'eglot-ensure)
|
|
|
|
(add-hook 'clojure-mode 'eglot-ensure)
|
|
|
|
|
|
|
|
|
2022-06-06 05:41:10 +02:00
|
|
|
;; Built-in mode configs
|
2022-06-13 02:43:01 +02:00
|
|
|
;; Ruby
|
2022-06-06 05:41:10 +02:00
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
'("\\.\\(?:cap\\|gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode))
|
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
'("\\(?:Brewfile\\|Capfile\\|Gemfile\\|[rR]akefile\\)\\'" . ruby-mode))
|
2022-06-13 02:43:01 +02:00
|
|
|
;; C/C++
|
|
|
|
(add-hook 'c++-mode-hook
|
|
|
|
(lambda () (setq flycheck-clang-include-path
|
|
|
|
(list (expand-file-name "/usr/include/")))))
|
|
|
|
(add-hook 'c-mode-hook
|
|
|
|
(lambda () (setq flycheck-clang-include-path
|
|
|
|
(list (expand-file-name "/usr/include/")))))
|
2022-06-06 05:41:10 +02:00
|
|
|
;;; modes.el ends here
|