Add a bunch of prog language support stuff
This commit is contained in:
parent
31f7e4b6c9
commit
4b225cf244
136
init.el
136
init.el
@ -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,48 +605,52 @@ 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
|
||||||
(require 'mu4e)
|
:ensure nil
|
||||||
(add-hook 'mu4e-index-updated-hook #'my/-mu4e-enable-index-messages)
|
:defer nil
|
||||||
(global-set-key (kbd "C-x C-m") #'mu4e)
|
:hook (mu4e-index-updated . my/-mu4e-enable-index-messages)
|
||||||
(global-set-key (kbd "C-x m") #'mu4e-compose-new)
|
:bind (("C-x C-m" . mu4e)
|
||||||
(define-key message-mode-map (kbd "C-c k") #'khard-insert-email-contact)
|
("C-x m" . mu4e-compose-new)
|
||||||
(evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer)
|
:map message-mode-map
|
||||||
(defun my/-mu4e-enable-index-messages ()
|
("C-c k" . khard-insert-email-contact))
|
||||||
(setq mu4e-hide-index-messages nil))
|
:init
|
||||||
(defun my/mu4e-update-mail-and-index-silent ()
|
(require 'mu4e)
|
||||||
"Run `mu4e-update-mail-and-index' without any messages in the background."
|
(evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer)
|
||||||
(setq mu4e-hide-index-messages t)
|
(defun my/-mu4e-enable-index-messages ()
|
||||||
(mu4e-update-mail-and-index t))
|
(setq mu4e-hide-index-messages nil))
|
||||||
(setq message-kill-buffer-on-exit t
|
(defun my/mu4e-update-mail-and-index-silent ()
|
||||||
message-send-mail-function 'sendmail-send-it
|
"Run `mu4e-update-mail-and-index' without any messages in the background."
|
||||||
mu4e-change-filenames-when-moving t
|
(setq mu4e-hide-index-messages t)
|
||||||
mu4e-context-policy 'pick-first
|
(mu4e-update-mail-and-index t))
|
||||||
mu4e-index-update-error-warning nil
|
(setq message-kill-buffer-on-exit t
|
||||||
mu4e-get-mail-command "mbsync protonmail"
|
message-send-mail-function 'sendmail-send-it
|
||||||
mu4e-completing-read-function #'completing-read-default
|
mu4e-change-filenames-when-moving t
|
||||||
mu4e-contexts
|
mu4e-context-policy 'pick-first
|
||||||
`(,(make-mu4e-context
|
mu4e-index-update-error-warning nil
|
||||||
:name "Personal"
|
mu4e-get-mail-command "mbsync protonmail"
|
||||||
:enter-func (lambda () (mu4e-message "Entered personal context"))
|
mu4e-completing-read-function #'completing-read-default
|
||||||
:match-func (lambda (msg)
|
mu4e-contexts
|
||||||
(when msg
|
`(,(make-mu4e-context
|
||||||
(string-match-p "^/protonmail/"
|
:name "Personal"
|
||||||
(mu4e-message-field msg
|
:enter-func (lambda () (mu4e-message "Entered personal context"))
|
||||||
:maildir))))
|
:match-func (lambda (msg)
|
||||||
:vars `((user-mail-address . ,(auth-source-pass-get "email" "emacs/mu4e-protonmail"))
|
(when msg
|
||||||
(user-full-name . ,(auth-source-pass-get "name" "emacs/mu4e-protonmail"))
|
(string-match-p "^/protonmail/"
|
||||||
(message-signature nil)
|
(mu4e-message-field msg
|
||||||
(mu4e-refile-folder . "/protonmail/Archive")
|
:maildir))))
|
||||||
(mu4e-sent-folder . "/protonmail/Sent")
|
:vars `((user-mail-address . ,(auth-source-pass-get "email" "emacs/mu4e-protonmail"))
|
||||||
(mu4e-drafts-folder . "/protonmail/Drafts")
|
(user-full-name . ,(auth-source-pass-get "name" "emacs/mu4e-protonmail"))
|
||||||
(mu4e-trash-folder . "/protonmail/Trash")
|
(message-signature nil)
|
||||||
(mu4e-bookmarks . ((:name "Inbox"
|
(mu4e-refile-folder . "/protonmail/Archive")
|
||||||
:query "maildir:/protonmail/Inbox"
|
(mu4e-sent-folder . "/protonmail/Sent")
|
||||||
:key ?i)
|
(mu4e-drafts-folder . "/protonmail/Drafts")
|
||||||
(:name "Unread"
|
(mu4e-trash-folder . "/protonmail/Trash")
|
||||||
:query "flag:unread AND NOT flag:trashed AND NOT maildir:/protonmail/Spam"
|
(mu4e-bookmarks . ((:name "Inbox"
|
||||||
:key ?u)))))))
|
:query "maildir:/protonmail/Inbox"
|
||||||
|
:key ?i)
|
||||||
|
(:name "Unread"
|
||||||
|
:query "flag:unread AND NOT flag:trashed AND NOT maildir:/protonmail/Spam"
|
||||||
|
: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)
|
||||||
|
Loading…
Reference in New Issue
Block a user