diff options
| author | cashmere <cashmere@autistici.org> | 2025-10-10 09:53:32 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2025-10-10 09:53:32 +0200 |
| commit | e91479bd7e1dfa13245d76ca40e7a1c12132deb0 (patch) | |
| tree | 896e297e943a338a63e6af2fcd4f4c3b51ca90bb /config.org | |
| parent | b5c014f54a2a71d592548409f5bf22d3df524b71 (diff) | |
| download | emacs-e91479bd7e1dfa13245d76ca40e7a1c12132deb0.tar.gz | |
fix org indentation
Diffstat (limited to 'config.org')
| -rw-r--r-- | config.org | 692 |
1 files changed, 404 insertions, 288 deletions
@@ -1,6 +1,7 @@ #+PROPERTY: header-args :tangle yes #+startup: content +* early-init #+begin_src emacs-lisp @@ -38,6 +39,7 @@ (setq kept-new-versions 5) (setq kept-old-versions 5) #+end_src + * Visual Optimizations Let's define some visual optimizations to change the appearnce of Emacs. @@ -47,142 +49,120 @@ #+begin_src emacs-lisp - (add-to-list 'default-frame-alist '(alpha-background . 90)) +(setq default-frame-alist + '((alpha-background . 90) + (undecorated . t))) #+end_src -* straight.el /commented out/ -#+begin_src emacs-lisp -;; (setq straight-check-for-modifications nil) -;; (defvar bootstrap-version) -;; (let ((bootstrap-file -;; (expand-file-name -;; "straight/repos/straight.el/bootstrap.el" -;; (or (bound-and-true-p straight-base-dir) -;; user-emacs-directory))) -;; (bootstrap-version 7)) -;; (unless (file-exists-p bootstrap-file) -;; (with-current-buffer -;; (url-retrieve-synchronously -;; "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" -;; 'silent 'inhibit-cookies) -;; (goto-char (point-max)) -;; (eval-print-last-sexp))) -;; (load bootstrap-file nil 'nomessage)) -;; -;; (straight-use-package '(project :type built-in)) -;; (straight-use-package 'use-package) -;; -;; (setq straight-use-package-by-default t) -#+end_src * emacs #+begin_src emacs-lisp ;;; EMACS - ;; This is biggest one. Keep going, plugins (oops, I mean packages) will be shorter :) - (setq debug-on-error t) - (use-package emacs - :straight nil - :ensure nil - :custom ;; Set custom variables to configure Emacs behavior. - (column-number-mode t) ;; Display the column number in the mode line. - (auto-save-default nil) ;; Disable automatic saving of buffers. - (create-lockfiles nil) ;; Prevent the creation of lock files when editing. - (delete-by-moving-to-trash t) ;; Move deleted files to the trash instead of permanently deleting them. - (delete-selection-mode 1) ;; Enable replacing selected text with typed text. - (display-line-numbers-type 'relative) ;; Use relative line numbering in programming modes. - (global-auto-revert-non-file-buffers t) ;; Automatically refresh non-file buffers. - (history-length 25) ;; Set the length of the command history. - (inhibit-startup-message t) ;; Disable the startup message when Emacs launches. - (initial-scratch-message "") ;; Clear the initial message in the *scratch* buffer. - (ispell-dictionary "en_US") ;; Set the default dictionary for spell checking. - (make-backup-files nil) ;; Disable creation of backup files. - ;; (pixel-scroll-precision-mode t) ;; Enable precise pixel scrolling. - (pixel-scroll-precision-use-momentum nil) ;; Disable momentum scrolling for pixel precision. - (ring-bell-function 'ignore) ;; Disable the audible bell. - (split-width-threshold 300) ;; Prevent automatic window splitting if the window width exceeds 300 pixels. - (switch-to-buffer-obey-display-actions t) ;; Make buffer switching respect display actions. - (tab-always-indent 'complete) ;; Make the TAB key complete text instead of just indenting. - (tab-width 4) ;; Set the tab width to 4 spaces. - (treesit-font-lock-level 4) ;; Use advanced font locking for Treesit mode. - (truncate-lines t) ;; Enable line truncation to avoid wrapping long lines. - (use-dialog-box nil) ;; Disable dialog boxes in favor of minibuffer prompts. - (use-short-answers t) ;; Use short answers in prompts for quicker responses (y instead of yes) - (warning-minimum-level :emergency) ;; Set the minimum level of warnings to display. +;; This is biggest one. Keep going, plugins (oops, I mean packages) will be shorter :) +(setq debug-on-error nil) +(use-package emacs + :straight nil + :ensure nil + :custom ;; Set custom variables to configure Emacs behavior. + (column-number-mode t) ;; Display the column number in the mode line. + (auto-save-default nil) ;; Disable automatic saving of buffers. + (create-lockfiles nil) ;; Prevent the creation of lock files when editing. + (delete-by-moving-to-trash t) ;; Move deleted files to the trash instead of permanently deleting them. + (delete-selection-mode 1) ;; Enable replacing selected text with typed text. + (display-line-numbers-type 'relative) ;; Use relative line numbering in programming modes. + (global-auto-revert-non-file-buffers t) ;; Automatically refresh non-file buffers. + (history-length 25) ;; Set the length of the command history. + (inhibit-startup-message t) ;; Disable the startup message when Emacs launches. + (initial-scratch-message "") ;; Clear the initial message in the *scratch* buffer. + (ispell-dictionary "en_US") ;; Set the default dictionary for spell checking. + (make-backup-files nil) ;; Disable creation of backup files. + ;; (pixel-scroll-precision-mode t) ;; Enable precise pixel scrolling. + (pixel-scroll-precision-use-momentum nil) ;; Disable momentum scrolling for pixel precision. + (ring-bell-function 'ignore) ;; Disable the audible bell. + (split-width-threshold 300) ;; Prevent automatic window splitting if the window width exceeds 300 pixels. + (switch-to-buffer-obey-display-actions t) ;; Make buffer switching respect display actions. + (tab-always-indent 'complete) ;; Make the TAB key complete text instead of just indenting. + (tab-width 4) ;; Set the tab width to 4 spaces. + (treesit-font-lock-level 4) ;; Use advanced font locking for Treesit mode. + (truncate-lines t) ;; Enable line truncation to avoid wrapping long lines. + (use-dialog-box nil) ;; Disable dialog boxes in favor of minibuffer prompts. + (use-short-answers t) ;; Use short answers in prompts for quicker responses (y instead of yes) + (warning-minimum-level :emergency) ;; Set the minimum level of warnings to display. - :hook ;; Add hooks to enable specific features in certain modes. - (prog-mode . display-line-numbers-mode) - (org-mode . display-line-numbers-mode) - ;; (org-mode . (lambda () (display-line-numbers-mode -1))) + :hook ;; Add hooks to enable specific features in certain modes. + (prog-mode . display-line-numbers-mode) + (org-mode . display-line-numbers-mode) + ;; (org-mode . (lambda () (display-line-numbers-mode -1))) - :config - (add-to-list 'custom-theme-load-path user-emacs-directory) - ;; (load-theme 'rose-pine t) + :config + (add-to-list 'custom-theme-load-path user-emacs-directory) + ;; (load-theme 'rose-pine t) - ;; By default emacs gives you access to a lot of *special* buffers, while navigating with [b and ]b, - ;; this might be confusing for newcomers. This settings make sure ]b and [b will always load a - ;; file buffer. To see all buffers use <leader> SPC, <leader> b l, or <leader> b i. - (defun skip-these-buffers (_window buffer _bury-or-kill) - "Function for `switch-to-prev-buffer-skip'." - (string-match "\\*[^*]+\\*" (buffer-name buffer))) - (setq switch-to-prev-buffer-skip 'skip-these-buffers) + ;; By default emacs gives you access to a lot of *special* buffers, while navigating with [b and ]b, + ;; this might be confusing for newcomers. This settings make sure ]b and [b will always load a + ;; file buffer. To see all buffers use <leader> SPC, <leader> b l, or <leader> b i. + (defun skip-these-buffers (_window buffer _bury-or-kill) + "Function for `switch-to-prev-buffer-skip'." + (string-match "\\*[^*]+\\*" (buffer-name buffer))) + (setq switch-to-prev-buffer-skip 'skip-these-buffers) - ;; Configure font settings based on the operating system. - ;; Ok, this kickstart is meant to be used on the terminal, not on GUI. - ;; But without this, I fear you could start Graphical Emacs and be sad :( - (set-face-attribute 'default nil :family "Maple Mono NF" :height 160) - ;; (when (eq system-type 'darwin) ;; Check if the system is macOS. - ;; (setq mac-command-modifier 'meta) ;; Set the Command key to act as the Meta key. - ;; (set-face-attribute 'default nil :family "Fragment Mono" :height 130)) + ;; Configure font settings based on the operating system. + ;; Ok, this kickstart is meant to be used on the terminal, not on GUI. + ;; But without this, I fear you could start Graphical Emacs and be sad :( + (set-face-attribute 'default nil :family "Maple Mono NF" :height 160) + ;; (when (eq system-type 'darwin) ;; Check if the system is macOS. + ;; (setq mac-command-modifier 'meta) ;; Set the Command key to act as the Meta key. + ;; (set-face-attribute 'default nil :family "Fragment Mono" :height 130)) - ;; Save manual customizations to a separate file instead of cluttering `init.el'. - ;; You can M-x customize, M-x customize-group, or M-x customize-themes, etc. - ;; The saves you do manually using the Emacs interface would overwrite this file. - ;; The following makes sure those customizations are in a separate file. - (setq custom-file (locate-user-emacs-file "custom-vars.el")) ;; Specify the custom file path. - (load custom-file 'noerror 'nomessage) ;; Load the custom file quietly, ignoring errors. + ;; Save manual customizations to a separate file instead of cluttering `init.el'. + ;; You can M-x customize, M-x customize-group, or M-x customize-themes, etc. + ;; The saves you do manually using the Emacs interface would overwrite this file. + ;; The following makes sure those customizations are in a separate file. + (setq custom-file (locate-user-emacs-file "custom-vars.el")) ;; Specify the custom file path. + (load custom-file 'noerror 'nomessage) ;; Load the custom file quietly, ignoring errors. - ;; Makes Emacs vertical divisor the symbol │ instead of |. - (set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?│)) + ;; Makes Emacs vertical divisor the symbol │ instead of |. + (set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?│)) - :init ;; Initialization settings that apply before the package is loaded. - (tool-bar-mode -1) ;; Disable the tool bar for a cleaner interface. - (menu-bar-mode -1) ;; Disable the menu bar for a more streamlined look. -;; (default-frame-alist '((undecorated . t))) - (when scroll-bar-mode - (scroll-bar-mode -1)) ;; Disable the scroll bar if it is active. + :init ;; Initialization settings that apply before the package is loaded. + (tool-bar-mode -1) + (menu-bar-mode -1) + (scroll-bar-mode -1) + (add-to-list 'default-frame-alist '(vertical-scroll-bars . nil)) + (add-to-list 'default-frame-alist '(horizontal-scroll-bars . nil)) - (global-hl-line-mode -1) ;; Disable highlight of the current line - (global-auto-revert-mode 1) ;; Enable global auto-revert mode to keep buffers up to date with their corresponding files. - (indent-tabs-mode -1) ;; Disable the use of tabs for indentation (use spaces instead). - (recentf-mode 1) ;; Enable tracking of recently opened files. - (savehist-mode 1) ;; Enable saving of command history. - (save-place-mode 1) ;; Enable saving the place in files for easier return. - (winner-mode 1) ;; Enable winner mode to easily undo window configuration changes. - (xterm-mouse-mode 1) ;; Enable mouse support in terminal mode. - (file-name-shadow-mode 1) ;; Enable shadowing of filenames for clarity. + (global-hl-line-mode -1) ;; Disable highlight of the current line + (global-auto-revert-mode 1) ;; Enable global auto-revert mode to keep buffers up to date with their corresponding files. + (indent-tabs-mode -1) ;; Disable the use of tabs for indentation (use spaces instead). + (recentf-mode 1) ;; Enable tracking of recently opened files. + (savehist-mode 1) ;; Enable saving of command history. + (save-place-mode 1) ;; Enable saving the place in files for easier return. + (winner-mode 1) ;; Enable winner mode to easily undo window configuration changes. + (xterm-mouse-mode 1) ;; Enable mouse support in terminal mode. + (file-name-shadow-mode 1) ;; Enable shadowing of filenames for clarity. -;;oding system for files to UTF-8. - (modify-coding-system-alist 'file "" 'utf-8) + ;;oding system for files to UTF-8. + (modify-coding-system-alist 'file "" 'utf-8) - ;; Add a hook to run code after Emacs has fully initialized. - (add-hook 'after-init-hook - (lambda () - (message "Emacs has fully loaded. This code runs after startup.") + ;; Add a hook to run code after Emacs has fully initialized. + (add-hook 'after-init-hook + (lambda () + (message "Emacs has fully loaded. This code runs after startup.") - ;; Insert a welcome message in the *scratch* buffer displaying loading time and activated packages. - (with-current-buffer (get-buffer-create "*scratch*") - (insert (format - ";; Welcome to Emacs! + ;; Insert a welcome message in the *scratch* buffer displaying loading time and activated packages. + (with-current-buffer (get-buffer-create "*scratch*") + (insert (format + ";; Welcome to Emacs! ;; ;; Loading time : %s ;; Packages : %s " - (emacs-init-time) - (length (hash-table-keys straight--recipe-cache)))))))) + (emacs-init-time) + (length (hash-table-keys straight--recipe-cache)))))))) #+end_src * emacs-kickstart font @@ -342,9 +322,6 @@ (280 . "#b4befe")))) #+end_src -#+begin_src emacs-lisp - -#+end_src * smerge #+begin_src emacs-lisp @@ -406,51 +383,48 @@ Disabled because nix is managing the flymake configuration. * org mode #+begin_src emacs-lisp - (use-package org - :straight nil - :ensure nil - :defer t - :config - (require 'org-tempo) - (custom-set-faces - '(org-document-title ((t (:height 1.6)))) - '(outline-1 ((t (:height 1.25)))) - '(outline-2 ((t (:height 1.2)))) - '(outline-3 ((t (:height 1.2)))) - '(outline-4 ((t (:height 1.2)))) - '(outline-5 ((t (:height 1.2)))) - '(outline-6 ((t (:height 1.2)))) - '(outline-7 ((t (:height 1.2)))) - '(outline-8 ((t (:height 1.2)))) - '(outline-9 ((t (:height 1.2))))) - (org-indent-mode -1) - (setq org-startup-folded 'content) - (setq org-adapt-indentation t - org-hide-leading-stars t - org-pretty-entities t - org-ellipsis " ") - (setq org-src-fontify-natively t - org-src-tab-acts-natively t - org-edit-src-content-indentation 0) - (setq org-log-done t - org-auto-align-tags t - org-tags-column -80 - org-fold-catch-invisible-edits 'show-and-error - org-special-ctrl-a/e t - org-insert-heading-respect-content t) +(use-package org + :straight nil + :ensure nil + :defer t + :config + (require 'org-tempo) + (custom-set-faces + '(org-document-title ((t (:height 1.6)))) + '(outline-1 ((t (:height 1.25)))) + '(outline-2 ((t (:height 1.2)))) + '(outline-3 ((t (:height 1.2)))) + '(outline-4 ((t (:height 1.2)))) + '(outline-5 ((t (:height 1.2)))) + '(outline-6 ((t (:height 1.2)))) + '(outline-7 ((t (:height 1.2)))) + '(outline-8 ((t (:height 1.2)))) + '(outline-9 ((t (:height 1.2))))) + + (setq org-startup-folded 'nil) + (setq org-adapt-indentation nil + org-hide-leading-stars t + org-pretty-entities t + org-ellipsis " ") + (setq org-src-fontify-natively t + org-src-tab-acts-natively t + org-edit-src-content-indentation 0) + (setq org-log-done t + org-auto-align-tags t + org-tags-column -80 + org-fold-catch-invisible-edits 'show-and-error + org-special-ctrl-a/e t + org-insert-heading-respect-content t) + + (add-hook 'org-mode-hook 'variable-pitch-mode) + (add-hook 'org-mode-hook 'org-indent-mode) + (add-to-list 'font-lock-extra-managed-props 'display) + (font-lock-add-keywords 'org-mode + `(("^.*?\( \)\(:[[:alnum:]_@#%:]+:\)$" + (1 `(face nil + display (space :align-to (- right ,(org-string-width (match-string 2)) 3))) + prepend))) t)) - ;; (my-local-leader - ;; ) - - (add-hook 'org-mode-hook 'variable-pitch-mode) - (add-to-list 'font-lock-extra-managed-props 'display) - (font-lock-add-keywords 'org-mode - `(("^.*?\( \)\(:[[:alnum:]_@#%:]+:\)$" - (1 `(face nil - display (space :align-to (- right ,(org-string-width (match-string 2)) 3))) - prepend))) t) - (setq org-blank-before-new-entry '((heading . nil) - (plain-list-item . nil)))) #+end_src ** org-appear @@ -464,7 +438,6 @@ Disabled because nix is managing the flymake configuration. org-appear-autolinks t ;; Show links org-appear-autosubmarkers t)) ;; Show sub- and superscripts #+end_src - ** org agenda We will start of with setting some sane configuration for org agenda. @@ -522,7 +495,14 @@ let us disable the predefined org agenda commands. #+begin_src emacs-lisp #+end_src +** exporter +*** typst + #+begin_src emacs-lisp +(use-package ox-typst + :straight (:host github :repo "jmpunkt/ox-typst") + :after org) + #+end_src ** denote Denote is objectively the best note taking extension, which you coul;d install. It has a very easy to parse file naming scheme and suports not only org files. It has also transclusion inclusive! if you are interested, then check it out yourself. @@ -535,6 +515,7 @@ Denote is objectively the best note taking extension, which you coul;d install. denote-directory (expand-file-name "~/org/"))) #+end_src *** denote-agenda + Denote itself focused on the last versions to have a core for note taking and to be independent of org. But of course you may extend it with your own extensions, functions and helper or even extensions by its developer. One of these extesions is =denote-agenda=, which allows you to dynamically add and remove org-agendas files based on a denote keyword. I set it to =task=, very simple. When we compare it with org-roam, It took me several days to achieve almost the same workflow, one or two external packages and around of 200 extra lines of code. #+begin_src emacs-lisp @@ -544,21 +525,24 @@ Denote itself focused on the last versions to have a core for note taking and to (setq denote-agenda-include-regexp "task") (denote-agenda-insinuate)) #+end_src + *** denote-menu #+begin_src emacs-lisp (use-package denote-menu -:ensure t -:config -(setq denote-menu-title-column-width 40 -denote-menu-show-file-type nil)) + :ensure t + :config + (setq denote-menu-title-column-width 40 + denote-menu-show-file-type nil)) #+end_src + *** denote-org #+begin_src emacs-lisp (use-package denote-org :ensure t) #+end_src + * which-key #+begin_src emacs-lisp @@ -572,6 +556,7 @@ denote-menu-show-file-type nil)) :custom (which-key-idle-delay 0.3)) #+end_src + * gcmh gcmh is for garbage collection @@ -580,6 +565,7 @@ denote-menu-show-file-type nil)) :config (gcmh-mode 1)) #+end_src + * vertico #+begin_src emacs-lisp @@ -605,6 +591,7 @@ denote-menu-show-file-type nil)) " ") cand)))) #+end_src + ** vertico-posframe #+begin_src emacs-lisp @@ -621,6 +608,7 @@ denote-menu-show-file-type nil)) ;; vertico-multiform-commands '((consult-line (:not posframe)) ;; (consult-ripgrep (:not posframe))))) #+end_src + * consult #+begin_src emacs-lisp @@ -656,6 +644,7 @@ denote-menu-show-file-type nil)) "\\`\\*Native-compile-Log\\*\\'" "\\`\\*Async-native-compile-log\\*\\'"))) #+end_src + * markdown-mode #+begin_src emacs-lisp @@ -671,6 +660,7 @@ denote-menu-show-file-type nil)) :mode ("README\\.md\\'" . gfm-mode) ;; Use gfm-mode for README.md files. :init (setq markdown-command "multimarkdown")) ;; Set the Markdown processing command. #+end_src + * consult #+begin_src emacs-lisp @@ -694,6 +684,7 @@ denote-menu-show-file-type nil)) (global-corfu-mode) (corfu-popupinfo-mode t)) #+end_src + * treesitter auto #+begin_src emacs-lisp @@ -707,6 +698,7 @@ denote-menu-show-file-type nil)) (treesit-auto-add-to-auto-mode-alist 'all) (global-treesit-auto-mode t)) #+end_src + * embark #+begin_src emacs-lisp @@ -731,7 +723,8 @@ denote-menu-show-file-type nil)) :defer t :after (:all corfu)) #+end_src -* embark consutl + +* embark consult #+begin_src emacs-lisp ;;; EMBARK-CONSULT @@ -743,6 +736,7 @@ denote-menu-show-file-type nil)) :hook (embark-collect-mode . consult-preview-at-point-mode)) ;; Enable preview in Embark collect mode. #+end_src + * orderless #+begin_src emacs-lisp @@ -771,6 +765,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi :hook (after-init . marginalia-mode)) #+end_src + * nerd corfu icons #+begin_src emacs-lisp @@ -781,31 +776,103 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi :defer t :after (:all corfu)) #+end_src + +* programming modes + +** nix-mode + + #+begin_src emacs-lisp + (use-package nix-mode + :ensure t + :mode "\\.nix\\'") + #+end_src + +** typst-mode + + #+begin_src emacs-lisp +(use-package typst-ts-mode + :straight t + :mode "\\.typ\\'" + :hook (typst-ts-mode . eglot-ensure) + :config + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + `(typst-ts-mode . ,(eglot-alternatives '("tinymist" "typst-lsp")))))) + #+end_src + +** rust mode + + #+begin_src emacs-lisp + (use-package rustic + :ensure t + :defer t + :custom + (rustic-lsp-client 'eglot)) + #+end_src + +*** org babel integration + + #+begin_src emacs-lisp + ;; Make sure rustic gets activated in the org-src block and add the original file's source code. +(defun my-read-file-to-string (file) + (with-temp-buffer + (insert-file-contents file) + (buffer-string))) + +(defun org-babel-edit-prep:rust (babel-info) + (setq-local src-code (nth 1 babel-info)) + (setq-local buffer-file-name (expand-file-name (->> babel-info caddr (alist-get :tangle)))) + (setq-local buffer-src-code (replace-regexp-in-string src-code "" (my-read-file-to-string (buffer-file-name)))) + (goto-char (point-max)) + (insert buffer-src-code) + (narrow-to-region (point-min) (+ (point-min) (length src-code))) + (rustic-mode) + (org-src-mode)) + +(defun my-delete-hidden-text () + (-let [p-start (point-max)] + (widen) + (delete-region p-start (point-max)))) + +(define-advice org-edit-src-exit + (:before (&rest _args) remove-src-block) + (when (eq major-mode 'rustic-mode) + (my-delete-hidden-text))) + +(define-advice org-edit-src-save + (:before (&rest _args) remove-src-block) + (when (eq major-mode 'rustic-mode) + (my-delete-hidden-text))) + #+end_src + * eglot #+begin_src emacs-lisp - (use-package eglot - :ensure nil - :straight nil - :hook ((rust-mode . eglot-ensure) - (nix-mode . eglot-ensure) - (python-mode . eglot-ensure) - (eglot-managed-mode . (lambda () (eldoc-mode -1)))) - :bind (:map eglot-mode-map - ("M-<return>" . eglot-code-actions) - ("C-M-." . xref-find-references) - ("C-c r" . eglot-rename)) - :config - (add-to-list 'eglot-server-programs - `(python-mode - . ,(eglot-alternatives '(("basedpyright-langserver" "--stdio") - ("pyright-langserver" "--stdio") - "jedi-language-server" - "pylsp")))) - (setq eldoc-echo-area-use-multiline-p nil - eglot-inlay-hints-mode -1) - (add-to-list 'eglot-server-programs '(nix-mode . ("nixd")))) +(use-package eglot + :ensure nil + :straight nil + :hook ((rustic-mode . eglot-ensure) + (nix-mode . eglot-ensure) + (python-mode . eglot-ensure) + ;; (eglot-managed-mode . (lambda () (eldoc-mode -1))) + ) + :bind (:map eglot-mode-map + ("M-<return>" . eglot-code-actions) + ("C-M-." . xref-find-references) + ("C-c r" . eglot-rename)) + :config + (add-to-list 'eglot-server-programs + `(python-mode + . ,(eglot-alternatives '(("basedpyright-langserver" "--stdio") + ("pyright-langserver" "--stdio") + "jedi-language-server" + "pylsp")))) + (setq eldoc-echo-area-use-multiline-p nil + eglot-inlay-hints-mode -1) + (add-to-list 'eglot-server-programs '(nix-mode . ("nixd")))) + #+end_src + ** eglot-booster #+begin_src emacs-lisp @@ -822,6 +889,14 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi :straight t :after (consult eglot)) #+end_src + +* olivetti + +#+begin_src emacs-lisp + (use-package olivetti + :defer t) +#+end_src + * eldoc #+begin_src emacs-lisp @@ -830,6 +905,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi :straight t :defer t) #+end_src + * diff-hl #+begin_src emacs-lisp @@ -851,6 +927,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi (unknown . "┆") (ignored . "i")))) #+end_src + * ff #+begin_src emacs-lisp @@ -863,6 +940,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi (setopt magit-format-file-function #'magit-format-file-nerd-icons)) ;; Turns on magit nerd-icons :defer t) #+end_src + * indent guide #+begin_src emacs-lisp @@ -880,22 +958,23 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi #+begin_src emacs-lisp - (use-package add-node-modules-path - :ensure t - :straight t - :defer t - :custom - ;; Makes sure you are using the local bin for your - ;; node project. Local eslint, typescript server... - (eval-after-load 'typescript-ts-mode - '(add-hook 'typescript-ts-mode-hook #'add-node-modules-path)) - (eval-after-load 'tsx-ts-mode - '(add-hook 'tsx-ts-mode-hook #'add-node-modules-path)) - (eval-after-load 'typescriptreact-mode - '(add-hook 'typescriptreact-mode-hook #'add-node-modules-path)) - (eval-after-load 'js-mode - '(add-hook 'js-mode-hook #'add-node-modules-path))) +;; (u se-package add-node-modules-path + ;; :ensure t + ;; :straight t + ;; :defer t + ;; :custom + ;; ;; Makes sure you are using the local bin for your + ;; ;; node project. Local eslint, typescript server... + ;; (eval-after-load 'typescript-ts-mode + ;; '(add-hook 'typescript-ts-mode-hook #'add-node-modules-path)) + ;; (eval-after-load 'tsx-ts-mode + ;; '(add-hook 'tsx-ts-mode-hook #'add-node-modules-path)) + ;; (eval-after-load 'typescriptreact-mode + ;; '(add-hook 'typescriptreact-mode-hook #'add-node-modules-path)) + ;; (eval-after-load 'js-mode + ;; '(add-hook 'js-mode-hook #'add-node-modules-path))) #+end_src + * general #+begin_src emacs-lisp @@ -916,6 +995,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi :keymaps 'override :prefix ",")) #+end_src + * evil #+begin_src emacs-lisp @@ -932,6 +1012,72 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi #+end_src + +** smart pairs + + #+begin_src emacs-lisp + (use-package smartparens + :ensure t + :hook ((emacs-lisp-mode . smartparens-strict-mode) + (lisp-mode . smartparens-strict-mode) + (scheme-mode . smartparens-strict-mode) + (clojure-mode . smartparens-strict-mode)) + :config + (require 'smartparens-config) + (smartparens-mode)) + + (use-package evil-smartparens + :ensure t + :after evil-collection + :hook (smartparens-global-mode . evil-smartparens-mode)) + + #+end_src + +** evil packages + + #+begin_src emacs-lisp + (use-package evil-collection + :after evil + :ensure t + :config + (evil-collection-init)) + + + (use-package evil-surround + :ensure t + :straight t + :after evil-collection + :config + (global-evil-surround-mode 1)) + + (use-package evil-matchit + :ensure t + :straight t + :after evil-collection + :config + (global-evil-matchit-mode 1)) + #+end_src + +** textobject + + #+begin_src emacs-lisp + (use-package evil-textobj-anyblock + :ensure t + :after evil + :config + (define-key evil-inner-text-objects-map "b" 'evil-textobj-anyblock-inner-block) + (define-key evil-outer-text-objects-map "b" 'evil-textobj-anyblock-a-block) + + (define-key evil-inner-text-objects-map "q" 'evil-textobj-anyblock-inner-quote) + (define-key evil-outer-text-objects-map "q" 'evil-textobj-anyblock-a-quote) + + (setq evil-textobj-anyblock-blocks + '(("(" . ")") + ("{" . "}") + ("\\[" . "\\]") + ("<" . ">")))) + #+end_src + * avy #+begin_src emacs-lisp @@ -960,32 +1106,6 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi #+begin_src emacs-lisp #+end_src -* evil packages - -#+begin_src emacs-lisp -(use-package evil-collection - :after evil - :ensure t - :config - (evil-collection-init)) - - -(use-package evil-surround - :ensure t - :straight t - :after evil-collection - :config - (global-evil-surround-mode 1)) - - - -(use-package evil-matchit - :ensure t - :straight t - :after evil-collection - :config - (global-evil-matchit-mode 1)) -#+end_src * undo-tree #+begin_src emacs-lisp @@ -1010,6 +1130,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi ;; This keeps undo history across sessions, stored in a cache directory. (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/.cache/undo")))) #+end_src + * Rainbow Delimiter #+begin_src emacs-lisp @@ -1162,7 +1283,7 @@ completion-category-overrides '((file (styles partial-completion))))) ;; Customi #+begin_src emacs-lisp ;;; UTILITARY FUNCTION TO INSTALL EMACS-KICK (defun ek/first-install () - "Install tree-sitter grammars and compile packages on first run..." + "dired" (interactive) ;; Allow this function to be called interactively. (switch-to-buffer "*Messages*") ;; Switch to the *Messages* buffer to display installation messages. (message ">>> All required packages installed.") @@ -1416,6 +1537,7 @@ mode-line-buffer-identification (when (member "Maple Mono NF" (font-family-list)) (set-face-attribute 'variable-pitch nil :family "Maple Mono NF" :height cashmere/font-height)) #+end_src + ** mixed pitch fonts (package) #+begin_src emacs-lisp @@ -1425,6 +1547,7 @@ mode-line-buffer-identification :hook ((org-mode . mixed-pitch-mode) (LaTeX-mode . mixed-pitch-mode))) #+end_src + * autothemer #+begin_src emacs-lisp @@ -1486,62 +1609,6 @@ mode-line-buffer-identification (setq dired-mouse-drag-files t)) #+end_src -* programming modes - -** nix-mode - - #+begin_src emacs-lisp - (use-package nix-mode - :ensure t - :mode "\\.nix\\'") - #+end_src - -** rust mode - - #+begin_src emacs-lisp - (use-package rustic - :ensure t - :defer t) - #+end_src - -*** org babel integration - - #+begin_src emacs-lisp - ;; Make sure rustic gets activated in the org-src block and add the original file's source code. - (defun org-babel-edit-prep:rust (babel-info) - ;; This gets the second item in the "babel-info" list, which holds the code in the original src block - (setq-local src-code (nth 1 babel-info)) - (setq-local buffer-file-name (expand-file-name (->> babel-info caddr (alist-get :tangle)))) - (setq-local buffer-src-code (replace-regexp-in-string src-code "" (my-read-file-to-string (buffer-file-name)))) - (goto-char (point-max)) - (insert buffer-src-code) - (narrow-to-region (point-min) (+ (point-min) (length src-code))) - (rustic-mode) - (org-src-mode)) - - (defun my-delete-hidden-text () - "Remove all text that would be revealed by a call to `widen'" - (-let [p-start (point-max)] - (widen) - (delete-region p-start (point-max)))) - - (define-advice org-edit-src-exit - (:before (&rest _args) remove-src-block) - (when (eq major-mode 'rustic-mode) - (my-delete-hidden-text))) - - (define-advice org-edit-src-save - (:before (&rest _args) remove-src-block) - (when (eq major-mode 'rustic-mode) - (my-delete-hidden-text))) - #+end_src - -** olivetti - -#+begin_src emacs-lisp - (use-package olivetti - :defer t) -#+end_src * olivetti global mode #+begin_src emacs-lisp :tangle yes @@ -1626,6 +1693,20 @@ mode-line-buffer-identification :ensure t :defer t) #+end_src +* zoom + + #+begin_src emacs-lisp + (use-package zoom + :ensure t + :defer t) + #+end_src +* pdf-tools + + #+begin_src emacs-lisp + (use-package pdf-tools + :ensure t) + #+end_src + * keybindings ** disable frame @@ -1736,13 +1817,17 @@ mode-line-buffer-identification "u" '(undo-tree-visualize :wk "undo tree") "P" '(consult-yank-from-kill-ring :wk "paste history")) #+end_src + ** local leader (,) #+begin_src emacs-lisp (my-local-leader -"a" '(org-agenda :wk "org agen") - "t" '(eat :wk "terminal")) + "a" '(org-agenda :wk "org agenda") + "t" '(eat :wk "terminal") + "c" '(my/centered-cursor :wk "center cursor") + "d" '(dirvish :wk "dired")) #+end_src + ** normal state #+begin_src emacs-lisp @@ -1765,6 +1850,7 @@ mode-line-buffer-identification ;; Global K binding für alle Modi mit eglot #+end_src + ** visual state #+begin_src emacs-lisp @@ -1786,7 +1872,7 @@ mode-line-buffer-identification (avy-background t) (scroll-margin 0) (maximum-scroll-margin 0)) - (call-interactively 'avy-goto-char-timer)))) + (call-interactively 'evil-avy-goto-char-2 )))) #+end_src ** dirvish @@ -1825,10 +1911,39 @@ mode-line-buffer-identification ** org-mode #+begin_src emacs-lisp + (my-local-leader :keymaps 'org-mode-map - "h" '(consult-org-heading :wk "search headings")) + "h" '(consult-org-heading :wk "search headings") + "n" '(my-toggle-org-tree-indirect-buffer :wk "toggle narrow")) + #+end_src + +** eat + + #+begin_src emacs-lisp + (general-def 'normal eat-mode-map + "C-l" 'eat-reset) + #+end_src + +*** focus headline + + #+begin_src emacs-lisp + ;; (defun my-toggle-org-tree-indirect-buffer () + ;; (interactive) + ;; (if (and (boundp 'my-org-indirect-buffer) + ;; my-org-indirect-buffer + ;; (buffer-live-p my-org-indirect-buffer)) + ;; (progn + ;; (kill-buffer my-org-indirect-buffer) + ;; (setq my-org-indirect-buffer nil)) + ;; (org-tree-to-indirect-buffer) + ;; (setq my-org-indirect-buffer (current-buffer)) + ;; (delete-other-windows))) + + ;; (evil-define-key 'normal 'org (kbd "z n") 'my-toggle-org-tree-indirect-buffer) + #+end_src + ** minibuffer #+begin_src emacs-lisp @@ -1839,9 +1954,10 @@ mode-line-buffer-identification (define-key minibuffer-local-must-match-map [escape] 'abort-recursive-edit) (define-key minibuffer-local-isearch-map [escape] 'abort-recursive-edit) #+end_src + ** scroll - #+begin_src emacs-lisp + #+begin_src emacs-lisp (global-set-key (kbd "C-=") 'text-scale-increase) (global-set-key (kbd "C--") 'text-scale-decrease) #+end_src |
