步步为营,零秒精通 Emacs

Dired初窥

在EmacsManual目录下调出Dird后,
快速略扫各个文件的主要内容.

在目录上C-n和C-p上下移动光标.

dired%E5%88%9D%E7%AA%A5

** Dired操作:

1. Entering Dired: C-x d
2. Navigation: C-n C-p
3. Delete files: d, x, D
4. Flagging many files at once:
1) # (file start with #)
2) ~ (flag all backup files whose name end with ~)
3) % d regexp (delete all match regex)

5. Visiting Files
- f or e (visit current file)
- o (another window to display and switch fucus)
- C-o (visit but not switch focus)
- v (view-mode)
- ^ (dired-up)

6. Dired Marks vs. Flags
- * * excutable files
- * m mark
- * @ symbolic link
- * / directory
- * u remove the current
- U remove all
- % m regex
7. Operatons on files
- C copy
- D delete
- R rename
- H hardlink
- S symblic link
- Z, c
8. Shell Commands in Dired
- 这次阅读最大的收获, 可以直接 & 和 X
9. Transform files names
- % u Uppper-case
- % l lowercase
10. File comparision
- dired-diff
11. Subdirectory in Dired
- i
12. Subdirectories switch in Dired
-
13. Moving Over Subdirectories
 -
14. Hiding Subdirectories
 -
15. Updating the Dired Buffer
 g
16. Dired and find
find-name-dired
17. Editing the dired Buffer
 wdired
18. View Images thumbnails
 image-dired-display-thumb
1 个赞

顶, 坚持写完。

1 个赞
** Register操作归纳

M-x view-register r
# 以下所有的命令最后一个letter, 可以自定义为a-z等任何字母.
1. Saving Positions in Registers
   C-x r r (register r)
   # 可以自定义为 C-x r a (能记住便好)
   C-x r j r (register jump to r)
2. Saving Text in Registers
   C-x r s t (register save to r) "text"
   # 修改为C-x r s t (t for text)
   C-x r i t (regiester insert to r) "text"
   M-x append-to-register t
   M-x prepend-to-register t
3. Saving Rectangles in Registers
   C-x r r e (rectangle region to e);
   # 此处省略一个r, 完整语义(C-x r r r e)
   # r been taken so use e for rectangle
   register rectangle region to e
   C-x r i e(rectangle insert to e )
4. Saving Window Configurations in Registers
   C-x r w w (register window to w)
   # 很好用的命令, 可以早上8点保存一个布局,晚上再看看, 临时记住的布局用winner-mode
   C-x r f f (register frameset to f)
   C-x r j f (jump)
5. Keeping Numbers in Registers
   No practical value.
6. Keeping File Names in Registers
   (set-register r '(file . name))
   (set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog")
   # prelude for bookmarks
7. Keyboard Macro Registers
   --
8. Bookmarks
   C-x r m (register bookmark for the current file)
   C-x r m  a-name
   C-x r M (not overwrite)
   C-x r b bookmark (jump or write)
   C-x r l (list all bookmarks)
   M-x bookmark-save
   M-x bookmark-load filename
   M-x bookmark-write filename
   M-x bookmark-delete bookmark
   M-x bookmark-insert-location bookmark

Additional

建议不要从零开始折腾Emacs,.
两步安装doom-emacs, 可以实现此项目内的所有操作.

Org Notebook的三个部分梳理:

  1. Documents Structure
  2. Table
  3. Hyper links

假期结束,今天恢复更新。

2 个赞

4. Emacs as a Notebook by Org

Appendix D: Email Management

Org-manual前四章(Notebook功能)总结:

  1. introduction 2) Documents 3)Table 4)Hyperlinks
- **Documents Structure**
 - Visibility Cycling
   + C-u C-u TAB :: Switch back to the startup visibility of the buffer
   + C-u C-u TAB :: org-set-startup-visibility
   + C-c C-k :: outline-show-branche
   + C-c C-x b :: org-tree-to-indirect-buffer
   + C-c C-j  org-goto :: Jump to a different place without changing the current outline visibility.
 - Structure Editing
   * C-RET :: org-insert-heading-respect-content
   * M-S-RET :: org-insert-todo-headin
   * C-S-RET :: org-insert-todo-heading-respect-content
   * TAB :: org-cycle
   * M-LEFT :: org-do-promote
   * M-RIGHT ::  org-do-demote
   * M-S-LEFT :: org-promote-subtree
   * M-S-RIGHT :: org-demote-subtree
   * M-UP :: org-move-subtree-up
   * M-DOWN :: org-move-subtree-down
   * C-c @ :: org-mark-subtree
   * C-c C-x C-w :: org-cut-subtree
   * C-c C-x M-w :: org-copy-subtree
   * C-c C-w :: org-refile
   * C-c ^  :: org-sort
   * C-x n s  :: org-narrow-to-subtree
   * C-x n b  :: org-narrow-to-block
   * C-x n w  :: widen
   * C-c * :: org-toggle-heading
 - Motion
   略
 - Sparse Tree
   + C-c / :: org-sparse-tree
     然后调用swiper
 - Plain Lists
   * TAB :: org-cycle
   * M-RET :: org-insert-heading
   * M-S-RET :: insert a new item with a checkbox
   * M-UP and M-DOWN :: move the items up and down
   * M-LEFT and M-RIGHT :: Decreae/increase the indentation
   * M-S-LEFT and M-S-RIGHT :: Decrease/increase indentations
   * C-c C-c :: toggle checkbox
   * C-c -  :: Cycle different bullets
   * S-LEFT and S-RIGHT :: cycles bullet styles
   * C-c *  :: Turn a plain list item into a headline
   * C-c C-* :: Turn the whole plain list into a subtree of the current heading. ()
   * C-c ^ :: Sort the plain list.
 - Drawer
   + C-c C-x d :: org-insert-drawer
   + C-c C-z  ::  Add a time-stamped note
 - Blocks
   略
- **Tables**
 - Built-in Table Editor
   + C-c | :: org-table-create-or-convert-from-region
 - Column Width and Alignment
   + C-c C-c :: org-table-align
   + M-LEFT and M-RIGHT :: org-table-move-column-right
   + M-S-LEFT and M-S-RIGHT :: org-table-delete-column and org-table-insert-column
   + M-UP and M-DOWN :: org-table-move-row-up and org-table-move-row-down
   + S-UP and S-DOWN :: org-table-move-cell-up and org-table-move-cell-down
   + M-S-UP :: org-table-kill-row
   + M-S-DOWN :: org-table-insert-row
   + C-c - :: org-table-insert-hline
   + C-c RET :: org-table-hline-and-move
   + C-c ^ :: org-table-sort-lines
   + C-c +  :: org-table-sum
   + S-RET :: org-table-copy-down √
   + C-c TAB :: org-table-toggle-column-widt
   + C-u C-c TAB :: org-table-shrink
   + C-u C-u C-c TAB :: org-table-expand
 - Column Groups
   + <>  :: Column Groups
 - The Orgtbl Minor Mode
   + M-x orgtbl-mode ::
 - The Spreadsheet
   略
 - Org Plot
   略
- **Hyperlinks**
 + internal link :: =[[internal-link]]=
 + file:projects.org::regex
 + gnus:group
 + shell:ls
 + elisp:(find_file "elisp.org")
 + elisp:org-agenda

在竞聘管理员, 差了20多票, 抽空给个支持.

此处提到两处弥足珍贵的键位绑定竟然空了出来, 没有被emacs作为绑定键使用。因而有机会将其自定义为”向上半屏翻页“和“向下半屏翻页”。

meta-n 调用 scroll-half-page-down, meta-p调用scroll-half-page-up。

然而,这个方法并不好用,尤其是快速浏览org笔记的时候,会被晃得晕头转向,还不如繁琐的M-r C-l C-l好用,因为焦点一直会停在中间。

而因为M-r C-l C-l 过于繁琐,出于本能,需要快速浏览的时候,就会只是快速的按键 C-n 不断地下一行。

作为解决方案,将

(scroll-up (/ (window-body-height) 2)))

修改为

(scroll-up (/ (window-body-height) 3)))

用了一段时间,尝试了不同的数值,三分很好用也符合直觉。速览的时候,M-n 然后 C-n再精确定位。

将函数名重新定义为 previous-multilines 与单行的previous-line保持一致。

(defun previous-multilines ()
  "scroll down half the page"
  (interactive)
  (scroll-down (/ (window-body-height) 3)))


(defun next-multilines ()
  "scroll up half the page"
  (interactive)
  (scroll-up (/ (window-body-height) 3)))

(global-set-key "\M-n" 'next-multilines) ;;custom
(global-set-key "\M-p" 'previous-multilines) ;;custom

关于进格删除(forward)与退格删除(backward)的语义化绑定。

退格删除则按键 backspace(Macbook上没有backspace键,可以将delete擦掉,改成backspace),backspace语义化对应backwords。

C-backspace 退格删除一个字符
M-backspace 退格删除一个word

进格删除的forward绑定到了字符 d(d for delete) 键上,

C-d 进格删除一个字符
M-d 进格删除一个word

C-k 进格删除到行尾
M-k 进格删除到句尾

C-x Backsapce 退格删除到行首

只有Backspace键是语义化的backword,其余都是forward。

最后,忘掉delete键,d 就是语义化的 delete。多余的delete键会引发逻辑上混乱。

1 个赞

这个编号有工具自动编号吗?还是自己手动编号的

手打的…