Add a bunch of prog language support stuff

This commit is contained in:
Alexander Rosenberg 2023-10-12 04:12:53 -07:00
parent 31f7e4b6c9
commit 4b225cf244
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

64
init.el
View File

@ -111,7 +111,12 @@
(java "https://github.com/tree-sitter/tree-sitter-java") (java "https://github.com/tree-sitter/tree-sitter-java")
(python "https://github.com/tree-sitter/tree-sitter-python") (python "https://github.com/tree-sitter/tree-sitter-python")
(rust "https://github.com/tree-sitter/tree-sitter-rust") (rust "https://github.com/tree-sitter/tree-sitter-rust")
(json "https://github.com/tree-sitter/tree-sitter-json"))) (json "https://github.com/tree-sitter/tree-sitter-json")
(css "https://github.com/tree-sitter/tree-sitter-css")
(go "https://github.com/tree-sitter/tree-sitter-go")
(js "https://github.com/tree-sitter/tree-sitter-javascript")
(bash "https://github.com/tree-sitter/tree-sitter-bash")
(cmake "https://github.com/uyha/tree-sitter-cmake")))
;; Tree sitter major mode conversions ;; Tree sitter major mode conversions
(setq major-mode-remap-alist (setq major-mode-remap-alist
'((c-mode . c-ts-mode) '((c-mode . c-ts-mode)
@ -119,7 +124,10 @@
(c-or-c++-mode . c-or-c++-ts-mode) (c-or-c++-mode . c-or-c++-ts-mode)
(java-mode . java-ts-mode) (java-mode . java-ts-mode)
(rust-mode . rust-ts-mode) (rust-mode . rust-ts-mode)
(json-mode . json-ts-mode)))) (json-mode . json-ts-mode)
(css-mode . css-ts-mode)
(js-mode . js-ts-mode)
(cmake-mode . cmake-ts-mode))))
;; c-ts-mode ;; c-ts-mode
(use-package c-ts-mode (use-package c-ts-mode
@ -395,8 +403,8 @@ visual states."
;; eglot ;; eglot
(use-package eglot (use-package eglot
:hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
python-ts-mode latex-mode) . eglot-ensure) latex-mode markdown-mode) . eglot-ensure)
(eglot-managed-mode . my/-eglot-setup)) (eglot-managed-mode . my/-eglot-setup))
:init :init
(defvar my/-eglot-documentation-buffer nil (defvar my/-eglot-documentation-buffer nil
@ -426,10 +434,20 @@ visual states."
"Setup eldoc variables for `eglot-managed-mode-hook'." "Setup eldoc variables for `eglot-managed-mode-hook'."
(setq-local eldoc-echo-area-use-multiline-p nil (setq-local eldoc-echo-area-use-multiline-p nil
evil-lookup-func #'my/eglot-documentation-at-point) evil-lookup-func #'my/eglot-documentation-at-point)
(evil-define-key '(normal motion) 'local "K" #'evil-lookup) (evil-define-key '(normal motion) 'local
"K" #'evil-lookup
"gR" #'eglot-rename
"gA" #'eglot-code-actions)
(eglot-inlay-hints-mode -1)) (eglot-inlay-hints-mode -1))
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) (setq eglot-autoshutdown t)
(setq eglot-autoshutdown t)) :config
(add-to-list 'eglot-server-programs
(cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode)
'("clangd" "--all-scopes-completion" "--background-index"
"--clang-tidy" "--completion-style=detailed"
"--header-insertion=never" "--pch-storage=memory"
"--malloc-trim" "--function-arg-placeholders")))
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
;; project.el ;; project.el
(use-package project (use-package project
@ -453,8 +471,12 @@ visual states."
my/project-vterm-hash-table)))) my/project-vterm-hash-table))))
(defvar my/project-run-command nil (defvar my/project-run-command nil
"Command to run with `my/project-run'.") "Command to run with `my/project-run'.")
(put 'my/project-run-command 'safe-local-variable (lambda (val)
(stringp val)))
(defvar my/project-run-dir nil (defvar my/project-run-dir nil
"Directory to run project in with `my/project-run'.") "Directory to run project in with `my/project-run'.")
(put 'my/project-run-dir 'safe-local-variable (lambda (val)
(stringp val)))
(defvar my/-project-run-history '() (defvar my/-project-run-history '()
"Commands previously run with `my/project-run'") "Commands previously run with `my/project-run'")
(defun my/project-get-root-dir () (defun my/project-get-root-dir ()
@ -490,6 +512,18 @@ COMMAND and COMINT are like `compile'."
;; rust ;; rust
(use-package rust-mode) (use-package rust-mode)
;; markdown
(use-package markdown-mode)
;; cmake
(use-package cmake-mode
:ensure nil
:hook (cmake-ts-mode . my/setup-cmake-ts-mode)
:init
(defun my/setup-cmake-ts-mode ()
"Setup `cmake-ts-mode' buffers."
(setq-local indent-line-function #'cmake-indent)))
;; json ;; json
(use-package json-mode) (use-package json-mode)
@ -571,12 +605,16 @@ COMMAND and COMINT are like `compile'."
;; mu4e ;; mu4e
(require 'auth-source-pass) (require 'auth-source-pass)
(auth-source-pass-enable) (auth-source-pass-enable)
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/") (use-package mu4e
:ensure nil
:defer nil
:hook (mu4e-index-updated . my/-mu4e-enable-index-messages)
:bind (("C-x C-m" . mu4e)
("C-x m" . mu4e-compose-new)
:map message-mode-map
("C-c k" . khard-insert-email-contact))
:init
(require 'mu4e) (require 'mu4e)
(add-hook 'mu4e-index-updated-hook #'my/-mu4e-enable-index-messages)
(global-set-key (kbd "C-x C-m") #'mu4e)
(global-set-key (kbd "C-x m") #'mu4e-compose-new)
(define-key message-mode-map (kbd "C-c k") #'khard-insert-email-contact)
(evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer) (evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer)
(defun my/-mu4e-enable-index-messages () (defun my/-mu4e-enable-index-messages ()
(setq mu4e-hide-index-messages nil)) (setq mu4e-hide-index-messages nil))
@ -612,7 +650,7 @@ COMMAND and COMINT are like `compile'."
:key ?i) :key ?i)
(:name "Unread" (:name "Unread"
:query "flag:unread AND NOT flag:trashed AND NOT maildir:/protonmail/Spam" :query "flag:unread AND NOT flag:trashed AND NOT maildir:/protonmail/Spam"
:key ?u))))))) :key ?u))))))))
(use-package mu4e-alert (use-package mu4e-alert
:after mu4e :after mu4e
:hook (after-init . mu4e-alert-enable-notifications) :hook (after-init . mu4e-alert-enable-notifications)