emacs 操作集锦
Emacs 中的剪切不叫剪切(cut),叫kill,复制(copy)不叫copy ,叫kill-ring-save (这个可以理解为先kill掉放到kill-ring里,然后再把它save回来)。另外还有一个操作叫delete ,delete 与kill的区别是kill掉的内容会被放到kill-ring(剪切环)而delete掉的内容则直接删掉了,除了进行undo操作外没法找回删掉的内容。而kill 掉的内容很容易从kill-ring中取回。有了kill-ring的Emacs可以说是具有了多个剪贴板。
默认的与kill yank delete 有关的键绑定。
- C-w kill-region
- C-k kill-line
- C-M-k kill-sexp 这个比较复杂 它表示删除一个结构单元。对不同类型的文档(c java文本 等)一个结构单元表示不同的含义。你可以尝试一下。(比如,你移动到一个括号的开头,按下,则删除整个括号内的内容)
- C-d delete-char
- M-d kill-word
- C-backspace backward-kill-word
- M-w kill-ring-save 复制。
- C-y yank 粘贴。
- 另外在按下C-y后,按一次或多次M-y 会循环取出kill-ring中的内容,然后贴到当前位置 。
- 但是kill-ring毕竟不是操作系统的剪切板,kill-ring里的内容是没法在其他程序里利用的。所以要用好它又设及到与系统剪切板的同步的问题了。 在Windows 上Emacs已经默认解决了这个问题。在linux上没有。因为Linux的剪切板不只一个。所以问题要复杂许多。
Linux 下 与系统系统剪切板相关的操作。
(defun setting-for-linux-x-clipboard (&optional frame)
(when (and (eq system-type 'gnu/linux)(eq (window-system frame) 'x))
;;在向kill-ring 加入内容的同时会执行interprogram-cut-function 变量指定的函数
(setq-default interprogram-cut-function 'x-select-text);
; default ;;在执行yank 操作时,会检查interprogram-paste-function 变量 所指向的函数 ;;是否有返回值,如果有的话就将其yank在buffer 中,否则的话才会从kill-ring中取值 ;;而x-cut-buffer-or-selection-value 和x-select-text函数一样, ;;也会根据x-select-enable-clipboard 和x-select-enable-primary 的值 ;;决定是否从clipboard 和primary 中取得内容
(setq-default interprogram-paste-function 'x-cut-buffer-or-selection-value)
;;有关于往kill-ring加入内容时 是否往clipboard ,及primary 放入的判断
(setq-default x-select-enable-clipboard t)
;每一次往kill-ring 里加入东西时,同时往clipboard中放一份,
(setq-default x-select-enable-primary nil)
;每一次往kill-ring 里加入东西时,是否也往primary 中放入
(setq-default select-active-regions t)
;这个忘了什么意思 ;;在轮询kill-ring 的时候是否也同步改变系统的clipboard primary ;;(要根据x-select-enable-clipboard ,及x-select-enable-primary的值决定哪个会被改变)
(setq-default yank-pop-change-selection t)
;;;Save clipboard strings into kill ring before replacing them
(setq-default save-interprogram-paste-before-kill t)
;; make mouse middle-click only paste from primary X11 selection, not clipboard and kill ring. ;;鼠标中键粘贴,只考虑X11中的selection ,不考虑clipboard 和emacs 中的kill-ring
(global-set-key [mouse-2] 'mouse-yank-primary)
;;其实有了以上几个配置 下面这三个键完全没有必要,但为防万一, ;;将与剪切板相关的三个操作绑到这三个不常用的键上.
(global-set-key [(shift delete)] 'clipboard-kill-region)
(global-set-key [(control insert)] 'clipboard-kill-ring-save)
(global-set-key [(shift insert)] 'clipboard-yank) ) )
=============================================================================================
二、set key Bindings
M-x global-set-key <RET> key cmd <RET>
Define key globally to run cmd. example: M-x global-set-key <RET> C-z shell <RET>
M-x local-set-key <RET> key cmd <RET>
Define key locally (in the major mode now in effect) to run cmd.
M-x global-unset-key <RET> key
Make key undefined in the global map.
M-x local-unset-key <RET> keyMake key undefined locally (in the major mode now in effect).
============================================================================================
Bookmark:
C-x r m RET Set the bookmark for the visited file, at point.
M-x bookmark-delete RET bookmark RET Delete the bookmark named bookmark.
View Mode:
Typing e (View-exit) disables View mode.
Follow Mode:
M-s (sp-splice-sexp) unwrap the list, example: (foo (bar| baz) quux) -> (foo bar| baz quux),附加的,与follow mode不相关。
Multiple buffers:
C-x C-b RET Popup a window to Select buffer (ibuffer).
C-x k C-x k runs the command ido-kill-buffer
C-x b buffername C-k kill buffer in background
Multiple windows:
C-x 2 (split-window-below) Split the selected window into two windows, one above the other
C-x 3 (split-window-right) Split the selected window into two windows, positioned side by side
C-x 4 d directory RET Select a Dired buffer for directory directory in another window (dired-other-window)
C-M-h Put region around whole current or following defun (mark-defun),选择整个函数
Imenu:
Indenting Several Lines:
Searching with Grep under Emacs:
M-x lgrep 异步查找
M-x grep 在当前目录进行grep,
Running Compilations under Emacs:
M-x recompile Invoke a compiler with the same command as in the last invocation of M-x compile
M-x kill-compilation Kill the running compilation subprocess
Running Debuggers Under Emacs:
M-x gdb
M-x gdb-many-windows works after M-x gdb
Dired, the Directory Editor:
Dired makes an Emacs buffer containing a listing of a directory, and optionally some of its subdirectories as well. You can use the normal Emacs commands to move around in this buffer, and special Dired commands to operate on the listed files.
C-x C-d (list-directory) list files in a directory, but it is not Dired
C-x d (dired) invoke Dired
Reading Mail with Rmail:
emacs 操作集锦的更多相关文章
- Eclipse for Java EE软件操作集锦(二)
看本文章之前请确保已经了解eclipse建立web工程,如果有疑问请查看本系列文章第一篇 eclipse软件操作集锦(一) 1.我们添加一个servlet 配置一下web.xml测试一下是否能正常显示 ...
- delphi关于文件操作集锦
关于文件操作集锦 取得该快捷方式的指向EXE关键词:快捷方式 LNK unit Unit1; interface usesWindows, Messages, SysUtils, Varian ...
- Eclipse for Java EE软件操作集锦(一)
以下是我在Java网站开发过程中,关于软件操作Eclipse中,遇到的一些问题并提供了解决方案.一.java web开发使用的集成开发工具是eclipse for Java EE 官方下载地址:htt ...
- php数组操作集锦- 掌握了数组操作, 也就掌握了php
参考下面的文章, 是很好的: http://www.cnblogs.com/staven/p/5142515.html http://pcwanli.blog.163.com/blog/static/ ...
- php字符串操作集锦
web操作, 主要就是对字符文本信息进行处理, 所以, 字符串操作几乎占了很大一部分的php操作.包括 注意strstr 和 strtr的区别? 前者表示字符串查找返回字符串,后者表示字符串中字符替换 ...
- XML文档操作集锦(C#篇)
在JSON没流行起来的时候xml一直作为程序存储配置信息的主流介质:特别是小型数据表方面还是不错的选择,所以经常涉及到的操作无非也就是增删改查,这篇博客主要是对这些对比较常用的操作做了个简单的总结 文 ...
- Microsoft Dynamics CRM 2011/2013 JS操作集锦
1.Xrm.Page.context用户ID:getUserId()用户角色:getUserRoles()用户语言:getUserLcid()组织名称:getOrgUniqueName()组织语言:g ...
- sql语句操作集锦
SQL操作全集 下列语句部分是Mssql语句,不可以在access中使用. SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT ...
- Microsoft Dynamics CRM 2011 JS操作集锦
1.Xrm.Page.context 用户ID:getUserId() 用户角色:getUserRoles() 用户语言:getUserLcid() 组织名称:getOrgUniqueName() 组 ...
随机推荐
- java 字符串函数
string1.equals(string2) 比较字符串 substring()它有两种形式,第一种是:String substring(int startIndex)第二种是:String sub ...
- maven3实战之仓库(快照版本)
maven3实战之仓库(快照版本) ---------- 在Maven的世界中,任何一个项目或者构件都必须有自己的版本.版本的值可能是1.0.0,1.3-alpha-4,2.0,2.1-SNAPSHO ...
- javascript高级编程运用
一//各种尺寸 (size) s += “\r\n网页可见区域宽:“+ document.body.clientWidth; s += “\r\n网页可见区域高:“+ document.body.cl ...
- 添加第三方类库造成的linker command failed with exit code 1 (use -v to see invocation)的错误调试
linker command failed with exit code 1 (use -v to see invocation)这个错误貌似遇见并不止一次,当我想用某个第三方类库的时候(如SBJso ...
- I.MX6 AT24Cxx eeprom Linux i2c-gpio
/************************************************************************** * I.MX6 AT24Cxx eeprom L ...
- 【英语】Bingo口语笔记(73) - 以tly,tely结尾的误读
- 【转】NSArray排序方法
原文网址:http://www.cnblogs.com/xiaobaizhu/archive/2013/06/05/3119983.html 从网上查的,非常方便的排序api,功能也很强大 1.sor ...
- 看人家如何拿到腾讯阿里的offer
我是如何同时拿到阿里和腾讯offer的: https://segmentfault.com/a/1190000002627927
- Mysql避免全表扫描sql查询优化 .
对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引: .尝试下面的技巧以避免优化器错选了表扫描: · 使用ANALYZE TABLE tbl_n ...
- Math.random();函数 随机数
random函数参数 无参数 random函数返回值 返回0和1之间的伪随机数,可能为0,但总是小于1,[0,1) random函数示例 document.write(Math.random()); ...