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() 组 ...
随机推荐
- js控制div是否显示
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- how to check unsolved conflicts file list in git merge?
how to check unsolved conflicts file list in git merge?
- (转)UILabel的详细使用
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 75, 40)]; //初始化UIlbel并设定frame lab ...
- 阿里云linux服务器安装Phalcon-----"phalcon Volt directory can't be written" "gcc: internal compiler error: Killed (program cc1)"
这里特别蛋疼的一件事是官方英文文档和中文文档命令参数略有不同 中文文档: //通用平台下安装指定的软件包: sudo yum install git gcc make pcre-devel php-d ...
- simplefactory简单工厂模式
简单工厂模式概述 又叫静态工厂方法模式,它定义一个具体的工厂类负责一些类的实例 优点 客户端不需要在负责对象的创建,从而明确了各个类的职责 缺点: 这个静态工厂类负责所有对象的创建, ...
- 【英语】Bingo口语笔记(45) - Pass系列
- LOL-无双剑姬我的最爱
LOL打了几年了,是一种娱乐的好方式,但是一个人玩不开黑就很无聊.这游戏最开始我玩的时候无论是赢是输就无所谓的,很高兴的.但是现在输了反而很气愤.也不知道为什么,所以很少玩了. 剑姬对反甲:如果对方出 ...
- 【转】Xcode添加静态库以及编译选项配置常见问题
原文网址:http://www.cnblogs.com/Quains/p/3276425.html 一,Xcode编译出现Link错误,出现"duplicate symbols for ar ...
- JS一般般的网页重构可以使用Node.js做些什么(转)
一.非计算机背景前端如何快速了解Node.js? 做前端的应该都听过Node.js,偏开发背景的童鞋应该都玩过. 对于一些没有计算机背景的,工作内容以静态页面呈现为主的前端,可能并未把玩过Node.j ...
- POJ 2241 Mondriaan's Dream
题意:给一块n×m的空地,用1×2的砖铺,有多少种方案. 解法:状压dp.考虑dp[i][j]表示前i - 1行都铺满时第i行的状态为j时的方案数.对于第i行,每个格子上是否有砖用0和1表示,0表示不 ...