diff options
Diffstat (limited to 'config.org')
| -rw-r--r-- | config.org | 155 |
1 files changed, 105 insertions, 50 deletions
@@ -830,56 +830,54 @@ Not necessary but an eyecandy to look at! #+begin_src emacs-lisp (use-package markdown-mode :ensure t - :hook (markdown-mode . nb/markdown-unhighlight) - :init - (setq-default abbrev-mode t) + :mode (("README\\.md\\'" . gfm-mode) + ("\\.md\\'" . markdown-mode) + ("\\.markdown\\'" . markdown-mode)) + :hook (markdown-mode . abbrev-mode) + :custom + ;; Use markdown-mode's display properties only: the source text is never + ;; replaced, and markup can always be restored with SPC m v. + (markdown-hide-markup t) + ;; Let the full markup toggle reveal link destinations as well. + (markdown-hide-urls nil) + (markdown-header-scaling t) + (markdown-header-scaling-values '(1.6 1.3 1.15 1.08 1.0 1.0)) + (markdown-fontify-code-blocks-natively t) + (markdown-asymmetric-header t) + (markdown-indent-on-enter 'indent-and-new-item) + (markdown-make-gfm-checkboxes-buttons t) + (markdown-gfm-uppercase-checkbox nil) + (markdown-enable-math t) + (markdown-list-item-bullets '("●" "○" "◆" "◇")) + (markdown-blockquote-display-char '("▌" ">")) + (markdown-hr-display-char '(?─ ?-)) :config - (defvar nb/current-line '(0 . 0) - "(start . end) of current line in current buffer") - (make-variable-buffer-local 'nb/current-line) - - (defun nb/unhide-current-line (limit) - "Font-lock function" - (let ((start (max (point) (car nb/current-line))) - (end (min limit (cdr nb/current-line)))) - (when (< start end) - (remove-text-properties start end - '(invisible t display "" composition "")) - (goto-char limit) - t))) - - (defun nb/refontify-on-linemove () - "Post-command-hook" - (let* ((start (line-beginning-position)) - (end (line-beginning-position 2)) - (needs-update (not (equal start (car nb/current-line))))) - (setq nb/current-line (cons start end)) - (when needs-update - ;; FIX: Verwende jit-lock-refontify statt font-lock-fontify-block - (jit-lock-refontify start end)))) - - (defun nb/markdown-unhighlight () - "Enable markdown concealling" - (interactive) - (markdown-toggle-markup-hiding 'toggle) - (font-lock-add-keywords nil '((nb/unhide-current-line)) t) - ;; FIX: Stelle sicher dass jit-lock aktiv ist - (jit-lock-register #'font-lock-fontify-region) - (add-hook 'post-command-hook #'nb/refontify-on-linemove nil t)) + (defun my/markdown-apply-minimal-faces (&optional _theme) + "Apply the quiet, theme-adaptive typography used by Org buffers." + (let ((foreground (face-attribute 'default :foreground nil t)) + (muted (face-attribute 'shadow :foreground nil t))) + (dolist (spec '((markdown-header-face-1 1.60 medium) + (markdown-header-face-2 1.30 semibold) + (markdown-header-face-3 1.15 semibold) + (markdown-header-face-4 1.08 semibold) + (markdown-header-face-5 1.00 medium))) + (set-face-attribute (car spec) nil + :family "SF Pro Display" + :height (cadr spec) + :weight (caddr spec) + :foreground foreground)) + (set-face-attribute 'markdown-header-face-6 nil + :family "SF Pro Display" :height 1.0 + :weight 'regular :foreground muted) + (set-face-attribute 'markdown-header-delimiter-face nil + :height 0.9 :weight 'normal :foreground muted) + (set-face-attribute 'markdown-markup-face nil :foreground muted))) - :custom-face - (markdown-header-delimiter-face ((t (:foreground "#616161" :height 0.9)))) - (markdown-header-face-1 ((t (:family "SF Pro Display" :height 1.65 :foreground "#A3BE8C" :weight bold :inherit markdown-header-face)))) - (markdown-header-face-2 ((t (:family "SF Pro Display" :height 1.45 :foreground "#EBCB8B" :weight bold :inherit markdown-header-face)))) - (markdown-header-face-3 ((t (:family "SF Pro Display" :height 1.3 :foreground "#D08770" :weight semibold :inherit markdown-header-face)))) - (markdown-header-face-4 ((t (:family "SF Pro Display" :height 1.2 :foreground "#BF616A" :weight semibold :inherit markdown-header-face)))) - (markdown-header-face-5 ((t (:family "SF Pro Display" :height 1.12 :foreground "#b48ead" :weight medium :inherit markdown-header-face)))) - (markdown-header-face-6 ((t (:family "SF Pro Display" :height 1.08 :foreground "#5e81ac" :weight medium :inherit markdown-header-face)))) - (markdown-code-face ((t (:inherit fixed-pitch)))) - (markdown-inline-code-face ((t (:inherit fixed-pitch)))) - (markdown-pre-face ((t (:inherit fixed-pitch))))) + (add-hook 'enable-theme-functions #'my/markdown-apply-minimal-faces) + (my/markdown-apply-minimal-faces)) #+end_src + ** agent-shell let's give agent-shell another try @@ -1219,7 +1217,7 @@ Use =org-modern= only for quiet structural markers in Org files. GTD labels, tim #+begin_src emacs-lisp #+end_src -** kitty-graphics +** COMMENT kitty-graphics Display inline images in terminal Emacs via the Kitty graphics protocol. Only activates when running in a Kitty terminal (not in GUI Emacs). @@ -2941,13 +2939,14 @@ BODY is the xonsh script. PARAMS may include :dir and :cmdline." :ensure t :commands (olivetti-mode) :preface - (defun my/org-writing-layout () - "Use a centered, comfortably spaced writing layout in Org buffers." + (defun my/prose-writing-layout () + "Use a centered, comfortably spaced prose-writing layout." (setq-local olivetti-body-width 88 line-spacing 0.14) (display-line-numbers-mode -1) (olivetti-mode 1)) - :hook (org-mode . my/org-writing-layout) + :hook ((org-mode . my/prose-writing-layout) + (markdown-mode . my/prose-writing-layout)) :custom (olivetti-style nil) ; Use window margins (fringes disabled in early-init) (olivetti-margin-width 10) ; No side margins @@ -4612,6 +4611,62 @@ place. `C-c C-c' commits, `C-c C-k' aborts." (evil-set-initial-state 'messages-buffer-mode 'normal) #+end_src +** markdown-mode + +#+begin_src emacs-lisp +(defvar my/markdown-leader-map (make-sparse-keymap)) +(defvar my/markdown-command-map (make-sparse-keymap)) +(defvar my/markdown-insert-map (make-sparse-keymap)) +(defvar my/markdown-table-map (make-sparse-keymap)) + +;; Recreate these maps on reload so removed bindings cannot linger. +(setq my/markdown-leader-map (make-sparse-keymap) + my/markdown-command-map (make-sparse-keymap) + my/markdown-insert-map (make-sparse-keymap) + my/markdown-table-map (make-sparse-keymap)) +(set-keymap-parent my/markdown-leader-map my/leader-map) +(keymap-set my/markdown-leader-map "m" my/markdown-command-map) +(keymap-set my/markdown-command-map "v" #'markdown-toggle-markup-hiding) +(keymap-set my/markdown-command-map "p" #'markdown-toggle-inline-images) +(keymap-set my/markdown-command-map "j" #'imenu) +(keymap-set my/markdown-command-map "b" #'markdown-cycle) +(keymap-set my/markdown-command-map "x" #'markdown-toggle-gfm-checkbox) +(keymap-set my/markdown-command-map "i" my/markdown-insert-map) +(keymap-set my/markdown-command-map "t" my/markdown-table-map) +(keymap-set my/markdown-insert-map "h" #'markdown-insert-header-dwim) +(keymap-set my/markdown-insert-map "l" #'markdown-insert-link) +(keymap-set my/markdown-insert-map "i" #'markdown-insert-image) +(keymap-set my/markdown-insert-map "q" #'markdown-insert-blockquote) +(keymap-set my/markdown-insert-map "c" #'markdown-insert-code) +(keymap-set my/markdown-insert-map "C" #'markdown-insert-gfm-code-block) +(keymap-set my/markdown-insert-map "f" #'markdown-insert-footnote) +(keymap-set my/markdown-insert-map "r" #'markdown-insert-hr) +(keymap-set my/markdown-table-map "i" #'markdown-insert-table) +(keymap-set my/markdown-table-map "a" #'markdown-table-align) +(keymap-set my/markdown-table-map "r" #'markdown-table-insert-row) +(keymap-set my/markdown-table-map "R" #'markdown-table-delete-row) +(keymap-set my/markdown-table-map "c" #'markdown-table-insert-column) +(keymap-set my/markdown-table-map "C" #'markdown-table-delete-column) + +(with-eval-after-load 'markdown-mode + (evil-define-key '(normal visual) markdown-mode-map + (kbd "SPC") my/markdown-leader-map + (kbd "RET") #'markdown-follow-thing-at-point) + (evil-define-key 'normal markdown-mode-map + (kbd "M-<up>") #'markdown-move-up + (kbd "M-<down>") #'markdown-move-down + (kbd "M-<left>") #'markdown-promote + (kbd "M-<right>") #'markdown-demote) + (evil-define-key 'insert markdown-mode-map + (kbd "M-SPC") my/markdown-leader-map)) + +(with-eval-after-load 'which-key + (which-key-add-keymap-based-replacements + my/markdown-leader-map "m" "markdown") + (which-key-add-keymap-based-replacements + my/markdown-command-map "i" "insert" "t" "table")) +#+end_src + ** org-mode #+begin_src emacs-lisp |
