Cycoe@Home

Org Mode 基本操作

1. Org Mode 使用训练

1.1. Org Mode 是什么

Org Mode 是 Emacs 的一个 Major Mode。

1.1.1. 特点

  1. 纯文本
  2. 来源于 Outline Mode
  3. 其中 95% 的功能是在发布后加上的
  4. 可以很简单,可以很复杂

1.1.2. Emacs 作者:Carsten Dominik

阿母斯特丹大学的一个天文学教授

1.2. Org Mode 能做什么

  • GTD、任务管理、日程计划
  • 做笔记
  • HTML 生成、静态博客

1.3. 建立简单清单

1.3.1. 在任何高级层级上通过 <M-return> 快捷键可以建立该层级的一个新项目

1.3.2. 在条目前加上 TODO 等关键字可以为条目增加属性

  • 或者光标在条目上 <S-left> 和 <S-right> 进行属性切换

1.3.3. `::` to generate a description list

  • Some tips to use description list
    Format :: description and content are splited with
    <M-Return>
    add new item with same indentation
    <M-S-Return>
    add new item with same indentation and a checkbox
    [X] <C-c C-c>
    check and uncheck the checkbox

1.4. 常用快捷键

[2019-11-03 Sun 20:12]

1.4.1. <C-u><C-c><!> insert time stamp [2019-11-03 Sun 19:51]

1.4.2. <C-c><C-x><C-i> clock in

1.4.3. <C-c><C-x><C-o> clock out

1.4.4. <S-right/left> to toggle current item with TODO, DONE or nothing

1.4.5. <S-right/left> to cycle in different style of enumrate

  1. Vim
  2. Emacs
  3. VS Code

1.4.6. <M-right/left> to change the level of item

1.4.7. <S-M-return> to create a same level item with TODO property

1.4.8. [1/3] Add '[1/3]' in front of item can get a countor for tasks

1.4.8.1. DONE Sleep
1.4.8.2. TODO Code
1.4.8.3. TODO Eat

1.4.9. <C-c><C-u> jump to the parent item

1.5. search and substitude

1.5.1. <C-s> begin incremental search

1.5.2. <C-s><C-s> or <C-r><C-r> to use last search result

1.5.3. <C-r> begin reverse incremental search

1.5.4. <M-e> edit search string when searching

1.5.5. <C-w> append the next word at point of search string

1.5.6. <enter> to exit search and stay at the current position

1.6. Footnote

A footnote is defined in a paragraph that is started by a footnote marker in square brackets in column 0, no indentation allowed.

The homepage1 of org mode now looks a lot better than it used to.

1.7. Tables

Name Phone Age
Peter 1234 12
Amy 345 14
  • <C-c C-c> to re-align the table without moving cursor
  • <C-c |> to convert a region to table field, data can be separated by tabs, spaces of even comma
  • <M-Left>/<M-Right> Move the current column left of right
  • <M-S-Left> Delete current column
  • <M-S-Right> Insert a column to the left of current column
  • <M-Up>/<M-Down>/<M-S-Up>/<M-S-Down> is similar to above hotkeys
  • <C-c -> Insert a horizontal line below current row
  • <C-c Return> Insert a horizontal line below current row and move the cursor into the next row
  • <C-c ^> Sort the table lines in the region. The position of point indicates the column to be used for sorting, and the range of lines is the range between the nearest horizontal separator lines, or the entire table.

1.8. Hyperlinks

Link format is description of link

  • <C-c C-l> to add a new link. When the cursor is on a link, this key binding can edit the link part
  • <C-c C-o> or mouse click can open the link under cursor
  • add `` to article can add an anchor point that can be trace by internal link
  • Here is the syntax of the different ways to attach a search to a file link, together with an explanation:
- file:~/code/main.c::255 Find line 255
- file:~/xx.org::My Target Find ‘<<My Target>>’
- file:~/xx.org::#my-custom-id Find entry with custom id

1.9. TODO Priorities

Org mode supports three priorities: ‘A’, ‘B’, and ‘C’. ‘A’ is the highest, ‘B’ the default if none is given. Priorities make a difference only in the agenda.

  • <C-c> Set the priority of the current headline. Press ‘A’, ‘B’ or ‘C’ to select a priority, or SPC to remove the cookie.
  • <S-up/down> Increase/decrease priority of current headline.

1.10. Breaking tasks down into subtasks [1/2] [50%]

Insert either '[/]' or '[%]' to indicate the process of subtasks

1.10.1. TODO Write down the configurations

1.10.2. DONE watch video about Gnome

1.11. Checkbox

Every item in a plain list can be made into a checkbox by starting it with the string ‘[ ]’. Checkboxes are not included in the global TODO list,so they are often great to split a task into a number of simple steps. Here is an example of a checkbox list.

1.11.1. Write down the configurations [0/3]

  • [ ] Apple
  • [ ] Banana
  • [-] Soup
    • [ ] water
    • [X] vagetable
  • <C-c C-c> Toggle checkbox status or (with prefix arg) checkbox presence at point.
  • <M-S-Ret> Toggle checkbox status or (with prefix arg) checkbox presence at point. <M-S-RET> Insert a new item with a checkbox. This works only if the cursor is already in a plain list item

1.12. Tags   Tag  This

Here is three tags, Tag, Like and This.

1.12.1. Tag can use Inheritancal structure with headline   Tag

1.12.1.1. A Sublevel title like this   Title

And the 'A Sublevel title like this' has two tags, Tags and Title.

  • <C-c C-q> Enter new tags for the current headline. Org mode will either offer completion or a special single-key interface for setting tags, see below. After pressing RET, the tags will be inserted and aligned to org-tags-column. When called with a C-u prefix, all tags in the current buffer will be aligned to that column, just to make things look nice.
  • <C-c C-c> When the cursor is in a headline, this does the same as <C-c C-q>.

1.13. 代码块

以 `#+BEGIN_SRC language…#+END_SRC` 包含的部分会被解析为代码块。可选参数为

-n -t -h -w
显示行号 清除格式 设置高度 设置宽度
from matplotlib import pyplot as plt
import numpy as np

xlim = (0, 2 * np.pi)
x = np.linspace(*xlim, 300)
y = np.sin(x)

plt.plot(x, y, lw=1, c='r')
plt.xlim(xlim)
file_name = 'Org-mode-基本操作/python-pyplot.png'
plt.savefig(file_name)

return file_name
python-pyplot.png

1.14. Agenda

1.14.1. Add file to be tracked in agenda

<C-c [> or <M-x> org-agenda-files-to-front<Return>

Footnotes:

1

The link is: https://orgmode.org

Author: Cycoe (cycoejoo@163.com)
Date: <2020-05-26 Tue 14:50>
Generator: Emacs 29.1 (Org mode 9.6.6)
Built: <2024-01-27 Sat 21:20>