172 lines
5.5 KiB
EmacsLisp
172 lines
5.5 KiB
EmacsLisp
(custom-set-variables
|
|
;; custom-set-variables was added by Custom.
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
;; Your init file should contain only one such instance.
|
|
;; If there is more than one, they won't work right.
|
|
'(package-selected-packages
|
|
'(spell-fu helm-company company auto-complete laas aas yasnippet evil editorconfig markdown-mode auctex rust-mode nasm-mode lua-mode ada-mode diff-hl magit corfu consult vertico)))
|
|
(custom-set-faces
|
|
;; custom-set-faces was added by Custom.
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
;; Your init file should contain only one such instance.
|
|
;; If there is more than one, they won't work right.
|
|
)
|
|
|
|
(setq make-backup-files nil)
|
|
|
|
(unless (package-installed-p 'yasnippet)
|
|
(package-install 'yasnippet))
|
|
(add-to-list 'load-path
|
|
"~/.config/emacs/snippets")
|
|
(yas-global-mode 1)
|
|
(setq yas-triggers-in-filed t)
|
|
|
|
(global-prettify-symbols-mode 1)
|
|
(setq yas-triggers-in-field t)
|
|
|
|
; Global Autoactivating snippet engine
|
|
(unless (package-installed-p 'aas)
|
|
(package-install 'aas))
|
|
|
|
(use-package aas
|
|
:hook (LaTeX-mode . aas-activate-for-major-mode)
|
|
:hook (org-mode . aas-activate-for-major-mode)
|
|
:config
|
|
(aas-set-snippets 'text-mode
|
|
;; expand unconditionally
|
|
";o-" "ō"
|
|
";i-" "ī"
|
|
";a-" "ā"
|
|
";u-" "ū"
|
|
";e-" "ē"
|
|
";a:" "ä"
|
|
";o:" "ö"
|
|
";u:" "ü"
|
|
)
|
|
(aas-set-snippets 'global
|
|
"credpriv" "Yannick Reiß <yannick.reiss@protonmail.ch>"
|
|
"creduni" "Yannick Reiß <yannick.reiss@student.hs-rm.de>"
|
|
)
|
|
(aas-set-snippets 'c-mode
|
|
"/*" (lambda () (interactive)
|
|
(yas-expand-snippet "/* $1 */$0"))
|
|
)
|
|
(aas-set-snippets 'tex-mode
|
|
;; set condition!
|
|
:cond #'texmathp ; expand only while in math
|
|
"supp" "\\supp"
|
|
"On" "O(n)"
|
|
"O1" "O(1)"
|
|
"Olog" "O(\\log n)"
|
|
"Olon" "O(n \\log n)"
|
|
;; Use YAS/Tempel snippets with ease!
|
|
"amin" '(yas "\\argmin_{$1}") ; YASnippet snippet shorthand form
|
|
"amax" '(tempel "\\argmax_{" p "}") ; Tempel snippet shorthand form
|
|
;; bind to functions!
|
|
";ig" #'insert-register
|
|
";call-sin"
|
|
(lambda (angle) ; Get as fancy as you like
|
|
(interactive "sAngle: ")
|
|
(insert (format "%s" (sin (string-to-number angle))))))
|
|
;; disable snippets by redefining them with a nil expansion
|
|
(aas-set-snippets 'latex-mode
|
|
"supp" nil)
|
|
(aas-set-snippets 'global
|
|
";--" "—"
|
|
";->" "→")
|
|
(aas-global-mode))
|
|
|
|
;; LaTeX Autoactivating snippet engine
|
|
(unless (package-installed-p 'laas)
|
|
(package-install 'laas))
|
|
|
|
(use-package laas
|
|
:hook (LaTeX-mode . laas-mode)
|
|
:config ; do whatever here
|
|
(aas-set-snippets 'laas-mode
|
|
;; Custom LaTeX Shortcuts
|
|
"ß" (lambda () (interactive)
|
|
(yas-expand-snippet "\\\\$0"))
|
|
"sss" (lambda () (interactive)
|
|
(yas-expand-snippet "ß$0"))
|
|
"%%" (lambda () (interactive)
|
|
(yas-expand-snippet "\\%$0"))
|
|
",#" (lambda () (interactive)
|
|
(yas-expand-snippet "\\textbf{$1}$0"))
|
|
",m" (lambda () (interactive)
|
|
(yas-expand-snippet "\\\\( $1 \\\\) $0"))
|
|
";M" (lambda () (interactive)
|
|
(yas-expand-snippet " \\\\[ $1 \\\\] $0"))
|
|
";L" (lambda () (interactive)
|
|
(yas-expand-snippet "\\begin{align} $1 \\end{align}$0"))
|
|
"-->" "$\\rightarrow$"
|
|
"texmeta" (lambda () (interactive)
|
|
(yas-expand-snippet "% TODO: ${1:Do what?} `(current-time-string)`"))
|
|
"tgreen" (lambda () (interactive)
|
|
(yas-expand-snippet "\\textcolor{green}{$1}$0"))
|
|
"tblue" (lambda () (interactive)
|
|
(yas-expand-snippet "\\textcolor{blue}{$1}$0"))
|
|
|
|
;; set condition!
|
|
:cond #'texmathp ; expand only while in math
|
|
"supp" "\\supp"
|
|
"On" "O(n)"
|
|
"O1" "O(1)"
|
|
"Olog" "O(\\log n)"
|
|
"Olon" "O(n \\log n)"
|
|
"menge" (lambda () (interactive)
|
|
(yas-expand-snippet "\\mathbb{$1}$0"))
|
|
|
|
;; Greek Letters (Shortcuts)
|
|
"@a" "\\alpha"
|
|
"@A" "\\Alpha"
|
|
"@b" "\\beta"
|
|
"@B" "\\Beta"
|
|
"@p" "\\phi"
|
|
"@P" "\\Phi"
|
|
"@s" "\\sigma"
|
|
"@S" "\\Sigma"
|
|
"@m" "\\mu"
|
|
"@M" "\\Mu"
|
|
|
|
;; custom math shortcuts
|
|
"%%" "\\%"
|
|
"++" (lambda () (interactive)
|
|
(yas-expand-snippet "^{$1}$0"))
|
|
"mod" (lambda () (interactive)
|
|
(yas-expand-snippet "\\text{ mod }"))
|
|
"root" (lambda () (interactive)
|
|
(yas-expand-snippet "\\sqrt[$1]{$2}$0"))
|
|
"__" (lambda () (interactive)
|
|
(yas-expand-snippet "_{$1}$0"))
|
|
"circ" "\\circ"
|
|
"in" "\\in"
|
|
|
|
;; bind to functions!
|
|
"Sum" (lambda () (interactive)
|
|
(yas-expand-snippet "\\sum_{$1}^{$2} $0"))
|
|
"Span" (lambda () (interactive)
|
|
(yas-expand-snippet "\\Span($1)$0"))
|
|
;; add accent snippets
|
|
:cond #'laas-object-on-left-condition
|
|
"qq" (lambda () (interactive) (laas-wrap-previous-object "sqrt"))))
|
|
|
|
(global-hl-line-mode 1)
|
|
|
|
(unless (package-installed-p 'company)
|
|
(package-install 'company))
|
|
(add-hook 'after-init-hook 'global-company-mode)
|
|
|
|
(unless (package-installed-p 'helm-company)
|
|
(package-install 'helm-company))
|
|
|
|
(unless (package-installed-p 'spell-fu)
|
|
(package-install 'spell-fu))
|
|
(spell-fu-global-mode)
|
|
|
|
(add-hook 'spell-fu-mode-hook
|
|
(lambda ()
|
|
(spell-fu-dictionary-add (spell-fu-get-ispell-dictionary "de"))
|
|
(spell-fu-dictionary-add (spell-fu-get-ispell-dictionary "en"))
|
|
))
|