Emacs学习笔记

2012.9.23

先引用一篇文章http://www.douban.com/group/topic/12121637/

http://www.gnu.org/software/emacs/manual/,学习elisp

http://www.emacs.uniyar.ac.ru/doc/em24h/,实践

命令大全http://www.cs.rutgers.edu/LCSR-Computing/some-docs/emacs-chart.html

快捷键

C-left 向左移动一个单词

C-right 向右移动一个单词

M-e --- forward-sentence

M-a --- backward-sentence

M-} --- forward-paragraph

M-{ --- backward-paragraph

C-x ] --- forward-page

C-x [ --- backward-page

C-k --- kil-line 去掉所在行光标所在处之后的所有字符

C-w --- kill-region 相当于剪切

C-x i --- insert-file 在当前文件中插入所选文件的所有内容

M-d --- kill-word 删掉光标后的一个单词

M-DEL --- backward-kill-word  删掉光标前的一个单词

C-x C-f --- find-file 打开文件

C-x k --- kill-buffer

C-x C-v --- find-alternate-file

C-x C-s --- save-buffer

C-x C-c --- save-buffers-kill-emacs

C-_ --- undo 相当于撤销,可以撤销undo - -!具体的功能自己实践后才知道,其实这个快捷键也有redo的功能

C-x C-b --- list-buffer buffer列表

C-x b --- switch-to-buffer 切换buffer

C-x k --- kill-buffer

C-x o --- other-window

C-x 0 --- delete-window

C-x 1 --- delete-other-window

C-x 2 --- split-window-vertically

C-x 3 --- split-window-horizontally

C-x > --- scroll-right 将window向右“扯”

C-x < --- scroll-left 将window向左“扯”

C-s --- isearch-forward 搜索不到时输入C-s可从buffer头开始向前再搜一次

C-r --- isearch-backward 搜索不到时输入C-r可从buffer尾开始想后再搜一次

C-g --- If you type characters that aren't found, you need to press C-g twice; otherwise, it is enough to press it once.退出搜索

C-s M-p --- search backward in the history of search string 之后可按上下键切换内容

C-s M-n --- search forward in the history of search string 之后可按上下键切换内容

C-s M-y --- search for some marked text 将复制的内容粘贴入搜索内容中(Caution - Please note that the keybinding for pasting the text onto the search string is M-y and not C-yC-y does normally mean paste, but not when searching. When searching, C-y means append to the search string all the text from the point to the end of the line.)

C-x C-x --- exchange-dot-and-mark 切换mark和point

M-% --- replace one string with another 之后具体的操作在Emacs可以得到帮助,其中recursive editing,用C-r开启,C-M-c关闭然后继续进行替换。C-]表示彻底退出recursive editing而不继续进行替换

C-h C-h --- 所有帮助命令

C-h c --- discribe-key-briefly 指出指令的含义

C-h k --- discribe-key

C-h b --- all key bindings active at the moment

C-h f --- discribe-function

C-h C-f --- looks up the function in the info pages and, if it exists, it takes you to the location where it is described

M-$ --- exist-ispell-word,按r手动输入单词,按l可以在原基础上补全单词

ispell-region and ispell-buffer ---  not bound to any keys by default,用M-x + 函数名调用

C-x a i l --- add an abbreviation for your current major mode,定义时光标要停在缩写单词后面,定义好之后输入缩写+空格即可看到设置好的拓展名

C-x a i g --- add an abbreviation for all modes

M-x edit-abbrevs --- edit the abbreviations

M-x hippie-expand --- 自动寻找buffer存在的单词并补全

M-t --- transpose-words,交换前后两个单词

C-x C-t --- transpose-lines,交换上下两行

M-l --- downcase-word,使光标后的单词全变为小写

M-u --- upcase-word,使光标后的单词全变为大写

M-c --- capitalize-word,使光标后的单词首字母大写,其他为小写

C-x r k --- kill-rectangle,删除以mark和point为顶点确定的矩形内的内容

C-x r y --- yank-rectangle,粘贴以上删除的内容

C-x r t --- string-rectangle在指定矩形范围内中插入指定内容

C-x ( --- start-kbd-macro

C-x ) --- end-kbd-macro

C-x e --- call-last-kbd-macro

M-x name-last-kbd-macro --- 命名

M-x insert-kbd-macro --- 保存

C-@ --- set-mark-command

C-x q --- kbd-macro-query在定义宏时使用,表示使用宏时进行询问

etags用法(ubuntu下):

File Format

Extensions

asm

.a.asm.def.inc.ins.s.sa.src

C

.c.h*.cs.hs

C++

.C.H.c++.cc.cpp.cxx.h++.hh.hpp.hxx.M.pdb

COBOL

.COB.cob

erlang

.erl.hrl

FORTRAN

.F.f.f90.for

Java

.java

LISP

.cl.clisp.el.l.lisp.lsp.ml

Pascal

.p.pas

Perl

.pl.pm

PostScript

.ps

proc

.pc.m.lm

Prolog

.prolog

Python

.py

Scheme

.SCM.SM.oak.sch.scheme.scm.sm.ss.t

TeX

.TeX.bib.clo.cls.ltx.sty.tex

yacc

.y.ym

在终端中输入etags+×.后缀,即可创建TAGS文件

M-. --- find-tag

Key

Control

Meta

Control-Meta

a, e

Beginning, end of line

Beginning, end of statement

Beginning, end of function

F, b

Forward, back character

Forward, back word

Forward, back syntactic expression

t

Transpose characters

Transpose words

Transpose syntactic expressions

k

Kill line

Kill sentence

Kill syntactic expression

n, p

Next, previous

 

Forward, back list

h

 

Mark paragraph

Mark function

l

Recenter on line

 

Recenter on function


C-M-h --- mark function

C-M-SPC --- mark syntactic expression

C-x h --- mark whole buffer

C-c C-q --- indent all the lines in the current function

C-c C-a --- auto new line when active

M-x c-toggle-hungry-state --- 开启hungry-delete,用C-c C-d据说可以开启,但我这用不了。。

M-; --- 在最左端加入注释

C-c C-c --- 注释所选region的内容

C-u C-c C-c --- 取消所选region的注释

C-c C-n 和 C-c C-p --- 在预处理命令之间跳转

C-x ` --- 切换编译错误


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值