Chinaunix首页 | 论坛 | 博客
  • 博客访问: 627996
  • 博文数量: 227
  • 博客积分: 8017
  • 博客等级: 中将
  • 技术积分: 2069
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-08 22:50
文章分类

全部博文(227)

文章存档

2011年(10)

2010年(55)

2009年(28)

2008年(134)

我的朋友

分类: LINUX

2008-04-09 22:24:32

以前一直将diary建成了dir, 今天才发现应该是个file:
于是一切shedule in emacs 变的很顺利了。。。
calendar/diary/appointment的一些命令:
. 跳回当天
o 跳到某一个月(英文单词)
g 这一系列命令表示goto,可以跳到指定的某一天。
g d   跳到某年某月某日
g c   跳到某年某星期的星期几
g C   跳到阴历的某一天
p 这一系列命令表示print,例如p C显示当前的阴历日期
>和< : 日历左右移动一个月
h: 显示指定日期的节日
m: mark diary entries
x: mark holidays
q: exit-calendar

M-x diary 显示当天的diary(不依赖与calendar)
d: 显示指定天的所有diary(calendar中光标所在处的date)
s: 显示整个diary文件
i d: Insert diary entry (如果内容占多行, 接下来的行添加空格或Tab)
i w/m/y: ...(表示每周/月/年的某天都会去做的事情)
i a: insert-anniversary-diary-entry
i b: insert-block-diary-entry
i c: insert-cyclic-diary-entry

M-x appt-add   :add appointment
M-x appt-delete :delete appointment


编辑命令:(持续更新中)

1.删除:

  • minibuffer删除单词: C-backspace
  • backspace :删除一个字符
  • C-backspace: 删除光标前的单词
  • C-x backspace: 删除光标前一个句子
  • M-d: 删除光标后的单词
  • M-backspce : 删除光标前的单词
  • C-w : 删除光标前的区域
  • C-k   : 从光标位置删除到行尾
  • C-x C-o: 删除光标周围的空白行

2.光标移动:
  • M-f   前进一个单词
  • M-b   后退一个单词
  • C-a   行首
  • C-e   行尾
  • M-a   句首
  • M-e   句尾
  • M-{   上一个段落
  • M-}   下一个段落
  • M-<   文件头
  • M->   文件尾

3.搜索:
  • C-s     : 增量式搜索;
  • C-s,跳到下一个搜索到的目标
  • C-s C-s :开始一次新的搜索
  • C-r       : 向前搜索
  • M-%     : 查询替换, (y,每次替换一个匹配。n 不替换 ! 一次全部替换)

4.编辑
  • C-x C-w : 文件另存为
  • C-spacee : 设置mark; C-@ 是默认命令, 不过有点与输入法冲突
  • M-s :center line
    M-S :center paragraph
    M-x center-region
  • M-q : fill paragraph (很方便,将光标放到段首,一下就可以整齐地fill整个段落了。)
  • 特殊字符: 按 C-x 8 R 可以输入 ® ,按 C-x 8 1 / 2可是输入: ½,等等。 按 C-x 8 C-h 可以得到一份完整的列表。

5. 大小写转换:     
  • set mark: M-@
  • C-x C-l : Convert region to lower case (downcase-region).
  • C-x C-u : Convert region to upper case (upcase-region).
  • M-l: Convert following word to lower case (downcase-word).
  • M-u: Convert following word to upper case (upcase-word).
  • M-c: Capitalize the following word (capitalize-word).

6.window操作:
  • C-x 0: delete-window
  • C-x 1: delete-other-windows
  • C-x 2: 垂直分割窗口
  • C-x 3: 水平分割窗口
  • C-x o: other-window

7. 粘贴
  • C-y 从kill-ring中取出第一个元素并粘贴
  • C-y M-y (从kill ring取第n个元素, n代表M-y的次数, 其实C-y 'yank' M-y 'yank-pop)
  • C-k :剪切一行 //这个相当有用。当然我还定制了一个C-w, 可以copy一行。

8. recover
  • 从 #file#中恢复: M-x recover-file file ;;yes ;; C-x C-s

9. mark
  • set mark: C-@ (set-mark-command)
  • clear mark: 在set mark后再按下C-@就可以clear mark了。

Dired mode

  • enter : C-x d 或 M-x dired
  • d: Flag this file for deletion.
  • u: Remove deletion flag on this line.
  • x: Delete the files that are flagged for deletion
  • #: Flag all auto-save files (files whose names start and end with `#')for deletion
  • ~: Flag all backup files (files whose names end with `~') for deletion
  • . : Flag excess numeric backup files for deletion.
  • % d REGEXP : Flag for deletion all files whose names match the regular
      expression REGEXP.
  • e/v: edit /Visit the file described on the current line
  • ^ :Visit the parent directory of the current directory
  • + :dired-create-directory


GUD/GDB mode:
M-x gdb --annotate=3 test ;;进入gdb
如果没有进入graphical mode可以 M-x gdba 然后输入你要debug的file
C-x       : set breakpoint ;;可以直接点击旁边的fringe set/clear 断点
C-c C-l   : clear breakpoint
C-c C-s   : step(step one line code but stop in function)
C-c C-n   : next(step one line code but stepping across function)
C-c C-f : finish function
C-c C-i   : stepi(Execute a single machine instruction)
C-c C-r   : continue(感觉还是直接按go按钮吧)
C-c C-d   : Delete the breakpoint(s) on the current source line

其他:
1. 如果更改了gdb的window 可以用: M-x gdb-restore-windows 恢复

在breakpoint buffer上:
2 Return : gdb-goto-breakpoint (即转到source对应的行)
3.D     : gdb-delete-breakpoint
4.Space   : Enable/disable the current breakpoint (`gdb-toggle-breakpoint')

5: 可以将鼠标放到一个variable上, 然后点击toolbar上的watch就可以watch a expression了
这是varibale显示在 speedbar中:
return: To expand or contract a complex data type
D     :   To delete a complex watch expression
space : To edit a variable with a simple data type
6: C-x C-a C-l : refresh a buffer


Programming:

1.Indentation
  • C-M-\       : indent-region
  • C-q         : 在缩进区域中添加tab
  • C-x h C-M-\ : indent whole buffer
  • M-;         : Insert or realign comment on current line;
  • C-u M-;     : Kill comment on current line (`comment-kill').
  • M-j         : If you are typing a comment and wish to continue it on another line. Just use it
  • M-x comment-region
  • M-x uncomment-region
2. Completion:
  • M-Tab : complete symbol(based on your own tag table)
  • C-u M-Tab : to complete the name of a standard library
3. Delete space
  • C-c C-d : Delete the entire block of whitespace following point.
  • C-c Backspace: Delete the entire block of whitespace preceding point.
4.Compile:
  • M-x compile/recompile
  • M-x kill compilation: Kill the running compilation subprocess.
5. Error:
  • C-x `     :Visit the locus of the next error message or match. (或M-g n)
  • C-u C-x ` :Visit the locus of the previous error message or match.(或M-g p)
6.在写程序的时候查询函数:
  • 在c-mode 下可以 C-h S 然后输入你要查询的函数或符号(光标处的为默认),如果在mode下可能会让你输入: symbol help mode, 例如输入c-mode就可以了。。。(这里的查询是info中查询,也可以查询man, 例如 man 3 ioctl)


Ediff:
发现Ediff 很好用,呵呵...
进入Ediff: M-x ediff , 然后输入你要比较的文件就行了命令列表:
  • n :ediff-next-difference
  • p: ediff-previous-difference
  • j: ediff-jump-to-difference(eg: 3 j 表示跳到第三个difference处)
  • v or C-v : ediff-scroll-vertically (Move forward one page in both buffers.)
  • V or M-v: ediff-scroll-vertically (Move backward one page in both buffers.)
  • < or > : move left or right
  • |: ediff-toggle-split (以水平或者垂直排列窗口)
  • a: ediff-copy-A-to-B
  • b: ediff-copy-B-to-A
  • r a or r b:ediff-restore-diff(Restore the current difference in buffer A (or B) to the way it was before copying from the other buffer.)
  • A or B: ediff-toggle-read-only(Switch the specified buffer into (or out of) read-only mode)
  • !: ediff-update-diffs(Recalculate and redisplay the highlighted regions)
  • w a or w b: ediff-save-buffer(Save the specified buffer to disk.)
  • q: ediff-quit (Close the Ediff window and end this comparison session.)
  • 其他的用 ? 查看吧


Bookmark:
  • C-x r m   :Set the bookmark for the visited file, at point.
  • C-x r l   : List all bookmarks (`list-bookmarks').
  • M-x bookmark-save     : Save all the current bookmark values in the default bookmark file.
  • M-x bookmark-delete   : delete a bookmark
  • o: 在另一个窗口中打开bookmark
    d: 标记删除:
    x: 执行删除
    r: 重命名
    u: 取消标记
    q: 退出


Help:
  • C-h r (read emacs info)
  • C-h k (查找对应的key, 可以查看某个key是否被binding, ('describe-key'))
  • C-h a (`apropos-command` Display a list of commands whose names match TOPICS)
  • C-h c KEY (Given a key sequence KEY, show the name of the command that it
         runs (`describe-key-briefly'))
  • C-h v (查看某个变量的文档, describe-variable)
  • C-h f 查看某个函数的文档。
  • C-h l (查看最近的100个命令)
  • C-h i (Run Info, the GNU documentation browser (`info'))
  • C-h m (Display documentation of the current major mode (`describe-mode'))
  • C-h p (Find packages by topic keyword (`finder-by-keyword'))
  • C-h w (Show which keys run the command, 'whereis')
  • M-x apropos: 用regexp搜索某个命令/函数/变量的文档


Artist-mode:
  • 进入: M-x artist-mode
  • 点击mouse3(一直找不到我的mouse3,后来发现按下滚轮就可以了...) 中选择你要划什么:
  • drawing : 选择你要画什么,Ellipse是椭圆, Filling可以填充
  • setting: 输入你要用的符号。比如a,line就可以了用'a'画线了
  • C-c C-c 退出artist-mode 进入原来的mode
  • 详细的看看



Info mode:
  • q :Quit Info
  • n :Move to the "next" node of this node.
  • p :Move to the "previous" node of this node
  • u :Move "up" from this node
  • l :Move back in history to the last node you were at.
  • f :Follow a cross reference.  Reads name of reference.
  • s :Search through this Info file for specified regexp,and select the node in which the next occurrence is found.
  • M-x Info-search-next :Search for another occurrence of regexp from a previous s command.
  • M-x info-apropos :Look for a string in the indices of all manuals.
  • TAB   :Move cursor to next cross-reference or menu item.
  • M-TAB :Move cursor to previous cross-reference or menu item.

others
  • M-x eval-current-buffer
  • M-x eval-buffer
  • C-c C-e (运行光标所在的语句)
  • M-x eval-region (运行所选区域)
  • 使更改的.Xdefauts生效: xrdb .Xdefaults
  • M-x byte-compile-file (编译elisp文件)


emacs 的加速启动:
  • emacs -q  不加载配置文件启动
  • emacs -Q  (=emacs -q --no-site-file --no-splash), 其中--no-site-file 表示do not load site-start.el, --no-splash 表示do not display a splash screen on startup
  • emacs -nw 以非 X 方式启动 emacs
  • 所以如果要快速编辑文件,就以emacs -Q -nw filename启动. 只是这样你定制的环境都没有了。不过, 这样的速度就跟vi差不多了.
  • 另外一种选择是你定制一个简单的配置文件, 然后启动时加载 emacs -q -l .femacs (其中.femacs是你的简单配置文件)
  • 我的解决办法是在~/.bashrc中加入alias femacs='sudo emacs -Q -nw', 然后logout一下就可以了。哈哈,尽情享受vi式简单的fast emacs把。


Added:

1、Emacs 's repeat:
    用来重复执行指令: C-u 3 C-x u (表明重复执行undo三次)
    也等于: M-3 C-x u
    (其中 C-u 3 = M-3)
    C-u 1 0 C-x u (执行undo 10次) = M-1 0 C-x u
2、


阅读(1214) | 评论(0) | 转发(0) |
0

上一篇:C的格式化

下一篇:C的一些技巧收集

给主人留下些什么吧!~~