From 849efca9114d499854f6b87a98b18f1b803ff2e0 Mon Sep 17 00:00:00 2001 From: noa Date: Wed, 9 Oct 2024 14:48:50 +0800 Subject: Move notes functions into new package --- emacs/init.el | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 5ea9fc6..0c3e08f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -736,13 +736,6 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ("" . howm-create)) (setopt howm-file-name-format "%Y-%m-%dT%H%M%S.md") -(defun noa/open-todays-diary () - (interactive) - (let ((date (format-time-string "%Y-%m-%d"))) - (find-file (format "~/Documents/notes/diary/%s.md" date)) - (if (= (buffer-size) 0) - (insert (concat "# " date "\n\n"))))) - ;;; Bibliography management (use-package ebib :ensure t @@ -770,3 +763,21 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (xeft-filename-fn (lambda (search) (format-time-string "%Y-%m-%dT%H%M%S.md"))) (xeft-recursive t)) +(defun noa/yank-buffer-file-name () + (interactive) + (when (buffer-file-name) + (kill-new (file-name-nondirectory (buffer-file-name))))) + +(use-package ctrlj) +(global-unset-key (kbd "C-j")) +(global-set-key (kbd "C-j C-j") #'ctrlj/open-note) +(global-set-key (kbd "C-j C-n") #'ctrlj/new-note) +(global-set-key (kbd "C-j C-l") #'ctrlj/insert-link-to-note) +(global-set-key (kbd "C-j C-d") #'ctrlj/open-todays-diary) +(global-set-key (kbd "C-j C-a") #'ctrlj/view-agenda) +(global-set-key (kbd "C-j C-o") #'ctrlj/jump-to-other-related-note) + +(defun noa/consult-rg-notes () + (interactive) + (consult-ripgrep "~/Documents/notes")) +(global-set-key (kbd "C-j C-s") #'noa/consult-rg-notes) -- cgit 1.4.1-2-gfad0