From 730482c98b0de9cc835640e8b90e5ab529cb9b56 Mon Sep 17 00:00:00 2001 From: materus Date: Thu, 5 Dec 2024 16:00:58 +0100 Subject: [PATCH] Update --- .../profile/home/editor/emacs/default.nix | 14 +++- .../config/emacs/emacs-materus-config.org | 74 +++++++++++++------ .../config/emacs/etc/materus/emacs-config.el | 73 ++++++++++++------ 3 files changed, 113 insertions(+), 48 deletions(-) diff --git a/configurations/profile/home/editor/emacs/default.nix b/configurations/profile/home/editor/emacs/default.nix index 5121b3e..b65b76c 100644 --- a/configurations/profile/home/editor/emacs/default.nix +++ b/configurations/profile/home/editor/emacs/default.nix @@ -131,6 +131,11 @@ let embark embark-consult ef-themes + pdf-tools + minimap + geiser-guile + fennel-mode + paredit # Completions & Minibuffer corfu corfu-terminal @@ -144,6 +149,12 @@ let emacsEnv = pkgs.buildEnv { name = "emacs-env"; paths = with pkgs; [ + luaformatter + (luajit.withPackages (p: [p.fennel p.lua-lsp])) + fennel-ls + fnlfmt + + guile plantuml mermaid-cli pyright @@ -153,7 +164,6 @@ let gnumake nixfmt-rfc-style python3Full - lua multimarkdown git emacs-lsp-booster @@ -169,7 +179,7 @@ let fpc nodejs omnisharp-roslyn - texlive.combined.scheme-basic + texlive.combined.scheme-full ]; }; diff --git a/extraFiles/config/emacs/emacs-materus-config.org b/extraFiles/config/emacs/emacs-materus-config.org index adebe72..7dc3fc3 100644 --- a/extraFiles/config/emacs/emacs-materus-config.org +++ b/extraFiles/config/emacs/emacs-materus-config.org @@ -43,7 +43,7 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]] - [[#projectile][Projectile]] - [[#treemacs][Treemacs]] - [[#magit][Magit]] - - [[#dirvish][Dirvish]] + - [[#dirvish--dired][Dirvish / Dired]] - [[#perspective][Perspective]] - [[#programming][Programming]] - [[#lsp][LSP]] @@ -518,6 +518,19 @@ Org mode settings :hook ((org-mode . toc-org-mode ) (markdown-mode . toc-org-mode))) + (setq org-latex-pdf-process '("latexmk -xelatex -quiet -shell-escape -f -output-directory=%o %f")) + (org-babel-do-load-languages + 'org-babel-load-languages + '((latex . t) + (emacs-lisp . t) + (shell . t) + (css . t) + (C . t) + (calc . t) + (awk . t) + (sql . t) + (sqlite . t))) + #+end_SRC ** Completions *** Style @@ -668,10 +681,12 @@ Other configs #+begin_src emacs-lisp (use-package magit) #+end_src -*** Dirvish +*** Dirvish / Dired #+begin_src emacs-lisp + (setq dired-mouse-drag-files t) (use-package dirvish - :config (dirvish-override-dired-mode 1) + :config + (dirvish-override-dired-mode 1) (setq dirvish-attributes '(vc-state subtree-state @@ -684,7 +699,8 @@ Other configs *** Perspective #+begin_src emacs-lisp (require 'perspective) - (customize-set-variable 'persp-mode-prefix-key (kbd "C-c M-p")) + (setq persp-mode-prefix-key (kbd "C-c M-p")) + (setq persp-modestring-short t) (persp-mode 1) #+end_src @@ -695,6 +711,7 @@ Other configs :custom (lsp-completion-provider :none) ;; we use Corfu! :config + (setq lsp-keep-workspace-alive nil) (require 'lsp-ui) :init (defun materus/orderless-dispatch-flex-first (_pattern index _total) @@ -775,10 +792,10 @@ Other configs (add-hook 'nix-mode-hook 'lsp-deferred) (add-hook 'nix-mode-hook 'display-line-numbers-mode) - ;;(add-hook 'nix-ts-mode-hook 'lsp-deferred) - ;;(add-hook 'nix-ts-mode-hook 'display-line-numbers-mode) + (add-hook 'nix-ts-mode-hook 'lsp-deferred) + (add-hook 'nix-ts-mode-hook 'display-line-numbers-mode) - ;;(when (treesit-language-available-p 'nix) (push '(nix-mode . nix-ts-mode) major-mode-remap-alist)) + (when (treesit-language-available-p 'nix) (push '(nix-mode . nix-ts-mode) major-mode-remap-alist)) #+end_src ** Emacs Lisp #+begin_src emacs-lisp @@ -791,26 +808,28 @@ Other configs (add-hook 'c-mode-hook 'lsp-deferred) (add-hook 'c-mode-hook 'display-line-numbers-mode) - ;(add-hook 'c-ts-mode-hook 'lsp-deferred) - ;(add-hook 'c-ts-mode-hook 'display-line-numbers-mode) + (add-hook 'c-ts-mode-hook 'lsp-deferred) + (add-hook 'c-ts-mode-hook 'display-line-numbers-mode) (add-hook 'c++-mode-hook 'lsp-deferred) (add-hook 'c++-mode-hook 'display-line-numbers-mode) - ;(add-hook 'c++-ts-mode-hook 'lsp-deferred) - ;(add-hook 'c++-ts-mode-hook 'display-line-numbers-mode) - ;(when (treesit-language-available-p 'c) (push '(c-mode . c-ts-mode) major-mode-remap-alist)) - ;(when (treesit-language-available-p 'cpp) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist)) + (add-hook 'c++-ts-mode-hook 'lsp-deferred) + (add-hook 'c++-ts-mode-hook 'display-line-numbers-mode) + (when (treesit-language-available-p 'c) (push '(c-mode . c-ts-mode) major-mode-remap-alist)) + (when (treesit-language-available-p 'cpp) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist)) (add-to-list 'c-default-style '(c-mode . "bsd")) (add-to-list 'c-default-style '(c++-mode . "bsd")) - ;(add-to-list 'c-default-style '(c-ts-mode . "bsd")) - ;(add-to-list 'c-default-style '(c++-ts-mode . "bsd")) + (add-to-list 'c-default-style '(c-ts-mode . "bsd")) + (add-to-list 'c-default-style '(c++-ts-mode . "bsd")) #+end_src ** Python #+begin_src emacs-lisp (use-package lsp-pyright) (setq lsp-pyright-langserver-command "pyright") (add-hook 'python-mode-hook 'lsp-deferred) + (add-hook 'python-ts-mode-hook 'lsp-deferred) + (when (treesit-language-available-p 'python) (push '(python-mode . python-ts-mode) major-mode-remap-alist)) #+end_src ** Java #+begin_src emacs-lisp @@ -820,11 +839,11 @@ Other configs (add-hook 'java-mode-hook 'lsp-deferred) (add-hook 'java-mode-hook 'display-line-numbers-mode) - ;(add-hook 'java-ts-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))))) - ;(add-hook 'java-ts-mode-hook 'lsp-deferred) - ;(add-hook 'java-ts-mode-hook 'display-line-numbers-mode) + (add-hook 'java-ts-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))))) + (add-hook 'java-ts-mode-hook 'lsp-deferred) + (add-hook 'java-ts-mode-hook 'display-line-numbers-mode) - ;(when (treesit-language-available-p 'java) (push '(java-mode . java-ts-mode) major-mode-remap-alist)) + (when (treesit-language-available-p 'java) (push '(java-mode . java-ts-mode) major-mode-remap-alist)) (add-to-list 'c-default-style '(java-mode . "java")) (add-to-list 'c-default-style '(java-ts-mode . "java")) @@ -840,7 +859,12 @@ Other configs (setq-default c-basic-offset 4) (setq-default c-indent-level 4) + + (setq-default c-ts-mode-indent-offset 4) + (setq-default c-ts-mode-indent-style 'bsd) + (setq-default c-hungry-delete-key t) + (electric-pair-mode 1) (electric-indent-mode -1) (setq-default tab-width 4) @@ -859,13 +883,15 @@ Other configs ;; Eat Term (define-key cua--eat-semi-char-keymap (kbd "C-v") #'eat-yank) (define-key cua--eat-char-keymap (kbd "C-S-v") #'eat-yank) + (define-key cua--eat-semi-char-keymap (kbd "C-c") #'copy-region-as-kill) + (define-key cua--eat-char-keymap (kbd "C-S-c") #'copy-region-as-kill) (define-key eat-mode-map (kbd "C-") #'eat-self-input) (define-key eat-mode-map (kbd "C-") #'eat-self-input) ;; perspective - (define-key global-map (kbd "C-x C-b") 'persp-list-buffers) - (define-key global-map (kbd "C-x C-B") 'list-buffers) - (define-key global-map (kbd "C-x b") 'persp-switch-to-buffer) - (define-key global-map (kbd "C-x B") 'consult-buffer) + (define-key global-map (kbd "C-x C-b") #'persp-list-buffers) + (define-key global-map (kbd "C-x C-B") #'list-buffers) + (define-key global-map (kbd "C-x b") #'persp-switch-to-buffer*) + (define-key global-map (kbd "C-x B") #'consult-buffer) ;; CUA-like global (define-key global-map (kbd "C-s") 'save-buffer) (define-key global-map (kbd "C-r") 'query-replace) @@ -972,6 +998,8 @@ Just for testing some code ;;; (set-window-margins (selected-window) 0 0) + ;;; (buffer-local-value 'var (get-buffer "your-buffer-name")) + ;;; (setq completion-styles '(orderless basic) ;;; completion-category-defaults nil ;;; completion-category-overrides '((file (styles partial-completion)))) diff --git a/extraFiles/config/emacs/etc/materus/emacs-config.el b/extraFiles/config/emacs/etc/materus/emacs-config.el index 3c525ea..e5df92e 100644 --- a/extraFiles/config/emacs/etc/materus/emacs-config.el +++ b/extraFiles/config/emacs/etc/materus/emacs-config.el @@ -304,6 +304,18 @@ :hook ((org-mode . toc-org-mode ) (markdown-mode . toc-org-mode))) +(setq org-latex-pdf-process '("latexmk -xelatex -quiet -shell-escape -f -output-directory=%o %f")) +(org-babel-do-load-languages + 'org-babel-load-languages + '((latex . t) + (emacs-lisp . t) + (shell . t) + (css . t) + (C . t) + (calc . t) + (awk . t) + (sql . t) + (sqlite . t))) ;; Org-mode:1 ends here ;; [[file:../../emacs-materus-config.org::*Style][Style:1]] @@ -448,9 +460,11 @@ (use-package magit) ;; Magit:1 ends here -;; [[file:../../emacs-materus-config.org::*Dirvish][Dirvish:1]] +;; [[file:../../emacs-materus-config.org::*Dirvish / Dired][Dirvish / Dired:1]] +(setq dired-mouse-drag-files t) (use-package dirvish - :config (dirvish-override-dired-mode 1) + :config + (dirvish-override-dired-mode 1) (setq dirvish-attributes '(vc-state subtree-state @@ -459,11 +473,12 @@ git-msg file-time file-size))) -;; Dirvish:1 ends here +;; Dirvish / Dired:1 ends here ;; [[file:../../emacs-materus-config.org::*Perspective][Perspective:1]] (require 'perspective) -(customize-set-variable 'persp-mode-prefix-key (kbd "C-c M-p")) +(setq persp-mode-prefix-key (kbd "C-c M-p")) +(setq persp-modestring-short t) (persp-mode 1) ;; Perspective:1 ends here @@ -472,6 +487,7 @@ :custom (lsp-completion-provider :none) ;; we use Corfu! :config + (setq lsp-keep-workspace-alive nil) (require 'lsp-ui) :init (defun materus/orderless-dispatch-flex-first (_pattern index _total) @@ -551,10 +567,10 @@ (add-hook 'nix-mode-hook 'lsp-deferred) (add-hook 'nix-mode-hook 'display-line-numbers-mode) -;;(add-hook 'nix-ts-mode-hook 'lsp-deferred) -;;(add-hook 'nix-ts-mode-hook 'display-line-numbers-mode) +(add-hook 'nix-ts-mode-hook 'lsp-deferred) +(add-hook 'nix-ts-mode-hook 'display-line-numbers-mode) -;;(when (treesit-language-available-p 'nix) (push '(nix-mode . nix-ts-mode) major-mode-remap-alist)) +(when (treesit-language-available-p 'nix) (push '(nix-mode . nix-ts-mode) major-mode-remap-alist)) ;; Nix:1 ends here ;; [[file:../../emacs-materus-config.org::*Emacs Lisp][Emacs Lisp:1]] @@ -567,26 +583,28 @@ (add-hook 'c-mode-hook 'lsp-deferred) (add-hook 'c-mode-hook 'display-line-numbers-mode) -;(add-hook 'c-ts-mode-hook 'lsp-deferred) -;(add-hook 'c-ts-mode-hook 'display-line-numbers-mode) +(add-hook 'c-ts-mode-hook 'lsp-deferred) +(add-hook 'c-ts-mode-hook 'display-line-numbers-mode) (add-hook 'c++-mode-hook 'lsp-deferred) (add-hook 'c++-mode-hook 'display-line-numbers-mode) -;(add-hook 'c++-ts-mode-hook 'lsp-deferred) -;(add-hook 'c++-ts-mode-hook 'display-line-numbers-mode) -;(when (treesit-language-available-p 'c) (push '(c-mode . c-ts-mode) major-mode-remap-alist)) -;(when (treesit-language-available-p 'cpp) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist)) +(add-hook 'c++-ts-mode-hook 'lsp-deferred) +(add-hook 'c++-ts-mode-hook 'display-line-numbers-mode) +(when (treesit-language-available-p 'c) (push '(c-mode . c-ts-mode) major-mode-remap-alist)) +(when (treesit-language-available-p 'cpp) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist)) (add-to-list 'c-default-style '(c-mode . "bsd")) (add-to-list 'c-default-style '(c++-mode . "bsd")) -;(add-to-list 'c-default-style '(c-ts-mode . "bsd")) -;(add-to-list 'c-default-style '(c++-ts-mode . "bsd")) +(add-to-list 'c-default-style '(c-ts-mode . "bsd")) +(add-to-list 'c-default-style '(c++-ts-mode . "bsd")) ;; C/C++:1 ends here ;; [[file:../../emacs-materus-config.org::*Python][Python:1]] (use-package lsp-pyright) (setq lsp-pyright-langserver-command "pyright") (add-hook 'python-mode-hook 'lsp-deferred) +(add-hook 'python-ts-mode-hook 'lsp-deferred) +(when (treesit-language-available-p 'python) (push '(python-mode . python-ts-mode) major-mode-remap-alist)) ;; Python:1 ends here ;; [[file:../../emacs-materus-config.org::*Java][Java:1]] @@ -596,11 +614,11 @@ (add-hook 'java-mode-hook 'lsp-deferred) (add-hook 'java-mode-hook 'display-line-numbers-mode) -;(add-hook 'java-ts-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))))) -;(add-hook 'java-ts-mode-hook 'lsp-deferred) -;(add-hook 'java-ts-mode-hook 'display-line-numbers-mode) +(add-hook 'java-ts-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))))) +(add-hook 'java-ts-mode-hook 'lsp-deferred) +(add-hook 'java-ts-mode-hook 'display-line-numbers-mode) -;(when (treesit-language-available-p 'java) (push '(java-mode . java-ts-mode) major-mode-remap-alist)) +(when (treesit-language-available-p 'java) (push '(java-mode . java-ts-mode) major-mode-remap-alist)) (add-to-list 'c-default-style '(java-mode . "java")) (add-to-list 'c-default-style '(java-ts-mode . "java")) @@ -615,7 +633,12 @@ (setq-default c-basic-offset 4) (setq-default c-indent-level 4) + +(setq-default c-ts-mode-indent-offset 4) +(setq-default c-ts-mode-indent-style 'bsd) + (setq-default c-hungry-delete-key t) + (electric-pair-mode 1) (electric-indent-mode -1) (setq-default tab-width 4) @@ -632,13 +655,15 @@ ;; Eat Term (define-key cua--eat-semi-char-keymap (kbd "C-v") #'eat-yank) (define-key cua--eat-char-keymap (kbd "C-S-v") #'eat-yank) +(define-key cua--eat-semi-char-keymap (kbd "C-c") #'copy-region-as-kill) +(define-key cua--eat-char-keymap (kbd "C-S-c") #'copy-region-as-kill) (define-key eat-mode-map (kbd "C-") #'eat-self-input) (define-key eat-mode-map (kbd "C-") #'eat-self-input) ;; perspective -(define-key global-map (kbd "C-x C-b") 'persp-list-buffers) -(define-key global-map (kbd "C-x C-B") 'list-buffers) -(define-key global-map (kbd "C-x b") 'persp-switch-to-buffer) -(define-key global-map (kbd "C-x B") 'consult-buffer) +(define-key global-map (kbd "C-x C-b") #'persp-list-buffers) +(define-key global-map (kbd "C-x C-B") #'list-buffers) +(define-key global-map (kbd "C-x b") #'persp-switch-to-buffer*) +(define-key global-map (kbd "C-x B") #'consult-buffer) ;; CUA-like global (define-key global-map (kbd "C-s") 'save-buffer) (define-key global-map (kbd "C-r") 'query-replace) @@ -735,6 +760,8 @@ ;;; (set-window-margins (selected-window) 0 0) +;;; (buffer-local-value 'var (get-buffer "your-buffer-name")) + ;;; (setq completion-styles '(orderless basic) ;;; completion-category-defaults nil ;;; completion-category-overrides '((file (styles partial-completion))))