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() 组 ...
随机推荐
- char和vchar
Varchar往往用来保存可变长度的字符串.简单的说,我们只是给其固定了一个最大值,然后系统会根据实际存储的数据量来分配合适的存储空间. 为此相比CHAR字符数据而言,其能够比固定长度类型占用更少的存 ...
- Codeforces Round #272 (Div. 2) D. Dreamoon and Sets (思维 数学 规律)
题目链接 题意: 1-m中,四个数凑成一组,满足任意2个数的gcd=k,求一个最小的m使得凑成n组解.并输出 分析: 直接粘一下两个很有意思的分析.. 分析1: 那我们就弄成每组数字都互质,然后全体乘 ...
- R语言将5位数字日期转为正常日期
R语言中用double表示日期,即从1970-1-1距离给定日期的天数,将5位数字日期转为正常日期格式的方法 as.Date(16543,origin='1970-1-1')
- shell动态解析sql的binlog
#!/usr/bin #设置数据库连接 conn='mysql -hhost -Pport -uusername -ppassword' #获取最新的binlog文件 logfile=$($conn ...
- linux 命令行字符终端terminal下强制清空回收站
回收站其实就是一个文件夹,存放被删掉的文件. ubuntu 回收站的路径: $HOME/.local/share/Trash/ 强制清空回收站: rm -fr $HOME/.local/share/T ...
- C与C++的区别无随时更新
C没有calss类,只有结构体struct class A; 在C中这样写就是错误的,C没有关键字class C的字符指针不会自动开辟内存空间,必须对这个指针指向的地址手动开辟空间后才可以写入数据. ...
- QQ网站如何检测对本地已经登录的qq用户
网上有很多猜测,比如—— QQ 登录时在本地某地方存登录 ID 信息(Cookie 或文件),用 js 读,然后去服务器认证.但是现在的浏览器一般有沙箱功能,js 无法读到登录 ID:而且在清空 Co ...
- grep -A -B选项详解和mysqlbinlog
grep的-A-B-选项详解(转)[@more@] grep能找出带有关键字的行,但是工作中有时需要找出该行前后的行,下面是解释 1. grep -A1 keyword filename 找出file ...
- 搭建Nginx(负载均衡)+Redis(Session共享)+Tomcat集群
一.环境搭建 Linux下Vagrant搭建Tomcat7.Java7 二.Nginx的安装配置与测试 *虚拟机下转至root sudo -i 1)下载并解压(目前官网最新版本) 创建安装目录:mkd ...
- javac 命令用法
引用自己写的Class 在java中手动编译时,总提示找不到类,调试成功后,特把目录结构与编译成功的命令列出: 样例一: 文件名 MessageStore.java Hello.java 源码 pac ...