org-modern-indent 使用教程
1. 项目介绍
org-modern-indent
是一个基于 Emacs 的开源项目,旨在为使用 org-mode 和 org-indent 的用户提供现代化的代码块样式。当启用 org-indent 时,默认的 org-mode 代码块样式(例如源代码块、示例块)的装饰会被禁用。这个包通过模拟 org-modern 的代码块样式,使得用户在使用 org-indent 时也能享受到 org-modern 的整洁高效样式。它可以在不使用 org-modern 的情况下单独使用,并且支持在列表中嵌套的“批量缩进”代码块。
2. 项目快速启动
首先,确保你已经安装了 Emacs 和 org-mode。
; 添加 org-modern-indent 到你的 Emacs 配置中
(use-package org-modern-indent
:load-path "~/code/emacs/org-modern-indent/")
; 或者使用 straight.el
(straight (org-modern-indent :type git :host github :repo "jdtsmith/org-modern-indent"))
; 将 org-modern-indent 模式添加到 org-mode 钩子中
(add-hook 'org-mode-hook #'(lambda () (org-modern-indent-mode 1)))
为了在所有 org 文件中默认启用 org-indent,你还需要设置:
(setq org-startup-indented t)
3. 应用案例和最佳实践
代码块样式
使用 org-modern-indent
后,你的 org 文件中的代码块将拥有现代化的样式。例如:
#+begin_src emacs-lisp
(message "Hello, World!")
#+end_src
在列表中使用代码块
在列表项中嵌套代码块时,确保开始标记 #+begin
与列表文本对齐:
- 这是一个列表项,它包含了一个代码块:
#+begin_src emacs-lisp
(message "Hello, List!")
#+end_src
修改样式
如果你想要自定义代码块的样式,可以通过修改 org-modern-indent-bracket-line
面来实现。
(set-face-attribute 'org-modern-indent-bracket-line nil :family "Hack" :height 1.0)
4. 典型生态项目
org-modern-indent
是 org-mode 生态系统的一部分,以下是一些相关的项目:
org-modern
: 一个现代化的 org-mode 样式包。org-bullets
: 使用 Unicode 符号替换标题和列表项的默认星号。org-superstar
: 美化标题和普通列表的外观。
通过结合这些项目,你可以进一步定制和改善你的 org-mode 体验。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考