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() 组 ...
随机推荐
- 第十篇 PO核心功能及流程详解
详见链接:http://bbs.erp100.com/thread-272866-1-1.html1. P2P lifecycleP2P是procure to pay的缩写,p2p循环值得就是采购到付 ...
- 概述hibernate入门安装配置
1.jdbc连接的优缺点 JDBC的优点 直接底层操作,提供了很简单.便捷的访问数据库的方法,跨平台性比较强.灵活性比较强,可以写很复杂的SQL语句. JDBC的缺点 1).因为JAVA是面向对象的, ...
- ERROR 1442 (HY000):because it is already used by statement which invoked this stored function/tr
看到mysql的触发器,随手写了一个: mysql> create trigger t_ai_test -> after insert on test -> for each row ...
- 极限编程,最强N皇后JAVA解题代码,4秒出15皇后,33秒出16皇后
私人博客原文链接来自:http://www.hexcode.cn/article/show/eight-queen 8皇后以及N皇后算法探究,回溯算法的JAVA实现,非递归,循环控制及其优化 8皇后以 ...
- link cut tree 入门
鉴于最近写bzoj还有51nod都出现写不动的现象,决定学习一波厉害的算法/数据结构. link cut tree:研究popoqqq那个神ppt. bzoj1036:维护access操作就可以了. ...
- checkbox美化;给div加上checked属性
DIV的背景图修改 $("#isOpenmibao").css("backgroundImage", " url('../images/checkbo ...
- [转帖]在RDLC中使用外部图片
原文链接:http://blog.csdn.net/rock870210/article/details/4559962 在RDLC中使用外部图片 2009-09-16 19:08 3416人阅读 评 ...
- Java RGB数组图像合成 ImageCombining (整理)
/** * Java RGB数组图像合成 ImageCombinning (整理) * * 2016-1-2 深圳 南山平山村 曾剑锋 * * 注意事项: * 1.本程序为java程序,同时感谢您花费 ...
- Windows 小技巧: 變更輸入法順序
Windows XP 中還是有辦法變更輸入法順序的!!只不過,要動用到 Regedit.exe 這個程式. 執行 Regedit.exe至 HKEY_CURRENT_USER\Keyboard Lay ...
- SpringMVC注解@initbinder解决类型转换问题
在使用SpringMVC的时候,经常会遇到表单中的日期字符串和JavaBean的Date类型的转换,而SpringMVC默认不支持这个格式的转换,所以需要手动配置,自定义数据的绑定才能解决这个问题.在 ...