还是入坑了org-mode

May 19, 2024 · 1055 words · 3 min ·   #PKM #Org

AI摘要

正在生成中……



再接上回,光速打脸。这次应该是最终方案了。🤣

org-roam#

在使用了nb一个星期之后,发现它的搜索还是不够强,中文适配不是很好,对文档内的内容查询也不太理想,可能是我还没找到遍历文档的插件或者正确的方法。

之前一直在考虑org和md文件转换是不是本末倒置,org和md 直接的桥梁一直在搭。但是org-mode实在太香了,无论是管理文档,还是搜索,可读性其实也不差。只是现在的博客和数字花园都是基于md,一直在权衡。现在基本是all in org-mode了,转换成md无非就多写个脚本,才一个星期就打脸了🤣。

在刚开始用Logseq的时候就久仰org-mode大名,后悔没有直接上手。现在用了之后,多多少少在Logseq里看到了org-mode的影子。剩下的就是熟读org和Emacs手册

Emacs,org-roam,模板创建Daily和note:

梳理一下现在的PKM模式:

以ACCESS结构管理「PKM-base库」,org-mode记录双链笔记,迭代输出成md到数字花园和blog。

tips#

一些org-roam的配置和小坑。

  • 开启

    (use-package org-roam
      :ensure t
      :custom
      (org-roam-directory (file-truename "/path/to/org-files/"))
      :bind (("C-c n l" . org-roam-buffer-toggle)
             ("C-c n f" . org-roam-node-find)
             ("C-c n g" . org-roam-graph)
             ("C-c n i" . org-roam-node-insert)
             ("C-c n c" . org-roam-capture)
             ;; Dailies
             ("C-c n j" . org-roam-dailies-capture-today))
      :config
      ;; If you're using a vertical completion framework, you might want a more informative completion interface
      (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
      (org-roam-db-autosync-mode)
      ;; If using org-roam-protocol
      (require 'org-roam-protocol))
    
  • org导出

    (setq org-export-with-toc nil) ;;禁止导出生成toc
    (org-roam-completion-everywhere t) ;;开启completion
    

    参考:

    https://emacs.readthedocs.io/en/latest/org_mode.html#export

    https://emacsdocs.org/docs/org/Exporting

  • org-roam侧窗口

    ;; For users that prefer using a side-window for the org-roam buffer, the following example configuration should provide a good starting point:对于喜欢使用侧窗口作为 org-roam 缓冲区的用户,以下示例配置应该提供一个很好的起点:
    (add-to-list 'display-buffer-alist
                 '("\\*org-roam\\*"
                   (display-buffer-in-side-window)
                   (side . right)
                   (slot . 0)
                   (window-width . 0.33)
                   (window-parameters . ((no-other-window . t)
                                         (no-delete-other-windows . t)))));; For users that prefer using a side-window for the org-roam buffer, the following example configuration should provide a good starting point:对于喜欢使用侧窗口作为 org-roam 缓冲区的用户,以下示例配置应该提供一个很好的起点:
    (add-to-list 'display-buffer-alist
                 '("\\*org-roam\\*"
                   (display-buffer-in-side-window)
                   (side . right)
                   (slot . 0)
                   (window-width . 0.33)
                   (window-parameters . ((no-other-window . t)
                                         (no-delete-other-windows . t)))))
    
  • org-roam-rapture模板分组

    ;; org-roam-rapture模板分组
    (setq org-roam-capture-templates
          '(
            ("d" "default" plain (function org-roam-capture--get-point)
             "%?"
             :file-name "%<%Y%m%d%H%M%S>-${slug}"
             :head "#+title: ${title}\n#+roam_alias:\n\n")
            ("g" "group")
            ("ga" "Group A" plain (function org-roam-capture--get-point)
             "%?"
             :file-name "%<%Y%m%d%H%M%S>-${slug}"
             :head "#+title: ${title}\n#+roam_alias:\n\n")
            ("gb" "Group B" plain (function org-roam-capture--get-point)
             "%?"
             :file-name "%<%Y%m%d%H%M%S>-${slug}"
             :head "#+title: ${title}\n#+roam_alias:\n\n")))
    

    参考:https://www.zmonster.me/2020/06/27/org-roam-introduction.html

  • ;; Bind this to C-c n I
    (defun org-roam-node-insert-immediate (arg &rest args)
      (interactive "P")
      (let ((args (cons arg args))
            (org-roam-capture-templates (list (append (car org-roam-capture-templates)
                                                      '(:immediate-finish t)))))
        (apply #'org-roam-node-insert args)))
    

    参考:https://systemcrafters.net/build-a-second-brain-in-emacs/5-org-roam-hacks/

  • 反链

    参考: https://emacs-china.org/t/org-roam-v2-backlinks-buffer-headlines/23368/3

  • 插入网页连接:

    技巧分享:在 emacs 中获取 firefox 当前标签页并生成 org link

    或利用org-roam-capture-ref https://www.zmonster.me/2020/06/27/org-roam-introduction.html



See also