emacs 作为一个编辑器

来源:互联网 发布:淘宝营销技巧 编辑:程序博客网 时间:2024/04/28 09:47

作为一个编辑器,我能想到需要的功能:

1.打开文件:

C-x C-f 打开文件

这里必须从CWD(current working directory)开始,设置方法(来自Stackoverflow):

  • Solution 1: Add (cd "C:/Users/Name/Desktop") to the .emacs file
  • Solution 2: Add (setq default-directory "C:/Documents and Settings/USER NAME/Desktop/" ) to the .emacs file
  • Solution 3: Right click the emacs short cut, hit properties and change the start in field to the desired directory.

当然,在linux下,可以直接M-x shell,运行shell,通过cd xxxx,打开的文件夹自动变成CWD。


2.关闭文件:

M-x kill-buffer或者C-x k   关闭当前buffer

推出emacs: C-x C-c


3.光标移动:

上下左右:C-p C-n C-b C-f

单词移动前后: M-f M-b

句子前后:M-e M-a

行首行尾:C-a C-e

上下翻页:M-v C-v

文件开头结尾:M-< M->

C-l 不动光标,主要是光标所在的行置于页首页中页尾


4.定位:

M-g g


5.保存

C-x C-s  保存单个buffer

C-x s 保存所有buffer


6.undo,redo:

C-x u:undo

redo需要到网上找相关的elisp,配置之后使用


7.查找,替换:

C-s 增量查找

替换没有,删除在写


8.复制黏贴:

内部:

C-@ 标记

M-w 复制

C-y yank恢复上次删除的内容到当前光标

系统:

C-y  能把系统剪贴板的内容复制到emacs中

M-x chipboard-kill-ring-save 复制

M-x clipboard-kill-region 剪切



9.输入删除:

删除:

<Delback> 删除一个before cursor

C-d 删除一个next cursor

M-<Delback> 移除一个before cursor

M-d 移除一个next cursor

C-k Kill from cursor to the end of line

M-k Kill from cursor to the end of sentence

C-@ mark set

C-w Kill from the mark to the position of cursor


输入中文:

1. install ibus-el package:
sudo apt-get install ibus-el

2. Put the following in your .emacs file:
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)


所有上面这些东西,不如阅读 A guided tour


作为一个代码编辑阅读工具:

1.语法高亮

2.自动缩进

3.代码折叠展开

4.变量函数跳转

5.多窗口编辑

6.自动打开引用文件。

7.API提示




原创粉丝点击