register 与bookmarks 混用,效果特佳. bookmarks 作为书签. 长久的习惯, register 属于临时性的享受跳跃的快感. 尤其是在想临时复制几个东西 到不同地点的时候, 可以应用 copy-to-register insert-register
---------------------------------------------------------
Emacs中的register
在多个文件中逛的时候,我们常常需要快速切换到先前访问的某个位置。因此,我们需要把文件及其光标位置暂时存放在某个地方。
在Emacs中,我们可以使用register暂时性保存这些信息。
将当前光标所在位置保存入一个register中:
C-x r SPACE + register名(一个字符,比如a吧)
然后我们就可以到处瞎逛,若要回到保存的register a位置,我们可以输入:
C-x r j a
挺好用的吧:)
如果你记性和我一样不好,恐怕会常常想看看自己保存了哪些register,我们可以输入:
M-x view-register 查看某一个register
M-x list-registers 查看所有的register
其实我常用的就是以上功能,为了使笔记稍微完整一点,下面开始Copy 《GNU Emacs Manual》的相关章节:
在下面,我们使用r来命名所有的register:
Save Positions in Registers
C-x r SPC r
Save position of point in register r (point-to-register).
C-x r j r
Jump to the position saved in register r (jump-to-register).
Saving Text in Registers
C-x r s r
Copy region into register r (copy-to-register).
C-x r i r
Insert text from register r (insert-register).
M-x append-to-register RET r
Append region to text in register r.
M-x prepend-to-register RET r
Prepend region to text in register r.
Saving Rectangles in Registers
C-x r r r
Copy the region-rectangle into register r (copy-rectangle-to-register). With numeric argument, delete it as well.
C-x r i r
Insert the rectangle stored in register r (if it contains a rectangle) (insert-register).
Saving Window Configurations in Registers
C-x r w r
Save the state of the selected frame's windows in register r (window-configuration-to-register).
C-x r f r
Save the state of all frames, including all their windows, in register r (frame-configuration-to-register).
Keeping Numbers in Registers
C-u number C-x r n r
Store number into register r (number-to-register).
C-u number C-x r + r
Increment the number in register r by number (increment-register).
C-x r g r
Insert the number from register r into the buffer.
没有评论:
发表评论