From 6b58f2928ee650b7203d4b59a94a20b88b9affb6 Mon Sep 17 00:00:00 2001 From: andsy10 Date: Sun, 10 May 2026 04:16:22 +0800 Subject: [PATCH] Config: install olivetti to prettify org-mode, edit some keybindings --- lisp/init-kbd-func.el | 6 ------ lisp/init-kbd.el | 9 ++++++--- lisp/init-org.el | 12 +++++------- lisp/init-ui.el | 10 ++++++++++ lisp/my-base16-dark-theme.el | 3 +++ lisp/my-base16-light-theme.el | 5 ++++- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el index 7011820..161ec0d 100644 --- a/lisp/init-kbd-func.el +++ b/lisp/init-kbd-func.el @@ -88,12 +88,6 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog (org-back-to-heading) (org-cycle))) -(defun consult-org-ripgrep () - "Search in org files use consult-ripgrep." - (interactive) - (consult-ripgrep (unless *is-windows* - '("~/org/my-org-note/" "~/org/hugo/this-is-my-blog/all-blog.org")))) - (defun my-denote-journal-path-to-existing-entry (&optional date interval) "Return the path of current denote journal if it exists, otherwise return nil." (require 'denote-journal) diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el index a8c757b..8a83ade 100644 --- a/lisp/init-kbd.el +++ b/lisp/init-kbd.el @@ -59,11 +59,13 @@ :prefix "C-c o" "f" 'consult-notes "s" 'consult-org-agenda - "g" 'consult-org-ripgrep + "g" 'consult-notes-search-in-all-notes "C" 'calendar "c" 'org-capture "p" 'my-blog-publish - "v" 'my-blog-preview) + "v" 'my-blog-preview + "d" 'denote + "r" 'denote-rename-file) ;; q for org-ql (general-def @@ -153,7 +155,8 @@ "C-c t l" 'org-toggle-link-display "M-{" 'org-previous-visible-heading "M-}" 'org-next-visible-heading - "C-," 'duplicate-and-move-to-next-line) + "C-," 'duplicate-and-move-to-next-line + "C-c o l" 'denote-link) ;; calendar (general-def calendar-mode-map diff --git a/lisp/init-org.el b/lisp/init-org.el index 87feb55..e6f9ed6 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -41,8 +41,8 @@ ;; 设置todo关键字 (setq org-todo-keywords - (quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)") - (sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)")))) + (quote ((sequence "TODO(t)" "STARTED(S)" "|" "DONE(d!/!)") + (sequence "WAITING(w@/!)" "SOMEDAY(s)" "|" "CANCELLED(c@/!)")))) ;; agenda相关 (with-eval-after-load 'recentf @@ -175,13 +175,11 @@ '(("t" "TODO" entry (file+headline "~/org/my-org-note/20260509T232442==agenda--all-my-todos__org.org" "Something to do") "* TODO %<%m-%d> %?\n%T" - :empty-lines 1 - :jump-to-captured t) - ("S" "someday" entry + :empty-lines 1) + ("s" "SOMEDAY" entry (file+headline "~/org/my-org-note/20260509T232442==agenda--all-my-todos__org.org" "Something to do") "* SOMEDAY %<%m-%d> %?\n%T" - :empty-lines 1 - :jump-to-captured t)))) + :empty-lines 1)))) (setq org-bookmark-names-plist nil) diff --git a/lisp/init-ui.el b/lisp/init-ui.el index 726c159..d9ee38a 100644 --- a/lisp/init-ui.el +++ b/lisp/init-ui.el @@ -30,6 +30,16 @@ colors)))) (string-trim (car (split-string choice))))) +;; org-mode美化 +(use-package olivetti + :config + (add-hook 'olivetti-mode-hook + (lambda () + (display-line-numbers-mode -1))) + (add-hook 'org-mode-hook + (lambda () + (olivetti-mode 1)))) + ;; rainbow mode (use-package rainbow-mode) diff --git a/lisp/my-base16-dark-theme.el b/lisp/my-base16-dark-theme.el index 9ac50f0..071fbcc 100644 --- a/lisp/my-base16-dark-theme.el +++ b/lisp/my-base16-dark-theme.el @@ -45,6 +45,9 @@ `(dired-async-mode-message ((,class (:foreground ,red)))) `(dired-async-message ((,class (:foreground ,yellow)))) `(consult-file ((,class (:foreground ,green)))) + `(consult-notes-name ((,class (:foreground ,base01 :weight bold)))) + `(consult-notes-time ((,class (:foreground ,base01 :weight thin)))) + `(consult-notes-size ((,class (:foreground ,base01 :weight thin)))) `(denote-faces-keywords ((,class (:foreground ,cyan)))) `(mode-line ((,class (:foreground ,base0 :background ,base02)))) `(mode-line-inactive ((,class (:foreground ,base01 :background ,base03)))) diff --git a/lisp/my-base16-light-theme.el b/lisp/my-base16-light-theme.el index 5ae42ce..f56740d 100644 --- a/lisp/my-base16-light-theme.el +++ b/lisp/my-base16-light-theme.el @@ -33,7 +33,7 @@ `(org-block-end-line ((,class (:foreground ,base01 :overline t :slant italic :extend t)))) `(org-priority ((,class (:foreground ,green :weight bold)))) `(org-checkbox ((,class (:foreground ,base0 :weight bold)))) - `(denote-journal-calendar ((,class (:foreground ,red)))) + `(denote-journal-calendar ((,class (:foreground ,red :slant italic)))) `(font-lock-keyword-face ((,class (:foreground ,cyan :weight bold)))) `(font-lock-doc-face ((,class (:foreground ,green :slant normal)))) `(font-lock-string-face ((,class (:foreground ,green)))) @@ -45,6 +45,9 @@ `(dired-async-mode-message ((,class (:foreground ,red)))) `(dired-async-message ((,class (:foreground ,yellow)))) `(consult-file ((,class (:foreground ,green)))) + `(consult-notes-name ((,class (:foreground ,base01 :weight bold)))) + `(consult-notes-time ((,class (:foreground ,base01 :weight thin)))) + `(consult-notes-size ((,class (:foreground ,base01 :weight thin)))) `(denote-faces-keywords ((,class (:foreground ,cyan)))) `(mode-line ((,class (:foreground ,base0 :background ,base02)))) `(mode-line-inactive ((,class (:foreground ,base01 :background ,base03))))