multiple-cursors实在是太好用了

*/-->

code {color: #FF0000}
pre.src {background-color: #002b36; color: #839496;}

multiple-cursors实在是太好用了

1 什么是multiple-cursors

multiple-cursors顾名思义,就是同时存在多个光标,这样就可以一次操作多个地方了。

官网:

https://github.com/magnars/multiple-cursors.el

2 常用的场景

2.1 同时修改多个变量或者函数名称,这一点和 iedit 模式比较像。

这个使用在编写html或者是xml的时候尤其使用的比较多。

2.2 在多个变量后面添加自增数字

3 配置

(use-package multiple-cursors
:bind (("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)
("C-M->" . mc/skip-to-next-like-this)
("C-M-<" . mc/skip-to-previous-like-this)
("C-c C-<" . mc/mark-all-like-this)
("C-S-<mouse-1>" . mc/add-cursor-on-click)
:map mc/keymap
("C-|" . mc/vertical-align-with-space))
:config
(setq mc/insert-numbers-default 1))

其中,使用鼠标点击添加/删除光标非常有用。有时候,我们不需要其中的一个光标,或者需要在某个地方添加一个光标,而用常规的方式很难选到的时候,用鼠标来选择操作会非常方便。

4 替换 iedit

替换 iedit ,主要是把快捷键 C-; 改掉:
:bind

("C-;"           . mc/mark-all-symbols-like-this-toggle)
("C-:" . mc/mark-all-symbols-like-this-in-defun)
:map mc/keymap
("C-|" . mc/vertical-align-with-space)
("C-_" . undo) ;undo-tree-undo point position wrong.
("C-;" . mc/my-quit)
("M-n" . mc/cycle-forward)
("M-p" . mc/cycle-backward)

然后,增加两个函数:

(defun mc/my-quit ()
"Quit from mark mode."
(interactive)
(mc/keyboard-quit)
(multiple-cursors-mode 0)) (defun mc/mark-all-symbols-like-this-toggle ()
"Toogle when only one matches!"
(interactive)
(if (region-active-p)
(mc/my-quit)
(mc/mark-all-symbols-like-this)))

Date: 2017-02-09 23:14

Created: 2017-02-24 周五 22:26

Emacs 26.0.50.4 (Org mode 8.2.10)

Validate

multiple-cursors实在是太好用了的更多相关文章

  1. 这届网友实在是太有才了!用python爬取15万条《我是余欢水》弹幕

    年初时我们用数据解读了几部热度高,但评分差强人意的国产剧,而最近正午阳光带着两部新剧来了,<我是余欢水>和<清平乐>,截止到目前为止,这两部剧在豆瓣分别为7.5分和7.9分,算 ...

  2. 剑指offer20题表示数值的字符串:这题实在是太优雅了

    目录 前言 一.憨憨初解 1.思路 2.代码 3.战绩 4.反思 二.看懂再解 1.思路 2.代码 3.C++版战绩 总结 前言 题目来源:https://leetcode.cn/problems/b ...

  3. Vus the Cossack and Strings(Codeforces Round #571 (Div. 2))(大佬的位运算实在是太强了!)

    C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist ...

  4. Python人工智能之路 - 第二篇 : 算法实在太难了有现成的直接用吧

    本节内容 预备资料: 1.FFmpeg: 链接:https://pan.baidu.com/s/1jonSAa_TG2XuaJEy3iTmHg 密码:w6hk 2.baidu-aip: pip ins ...

  5. QT太多的内容和模块,怎么办?

    我有个问题,QT可以做许多不同的开源项目,而且每个QT新版本都那么内容,感觉学不过来.用不过来那么我们还应该学习和使用其它语言吗? 如果回答,在需要的时候学习,那么这句话意味着,这几年你基本上就局限于 ...

  6. expdp/impdp数据泵分区表导入太慢了。添加不检查元数据参数提高效率:ACCESS_METHOD=DIRECT_PATH

    分区表数据泵导入太慢,达不到客户的迁移要求导出语句如下:(10G单节点)userid='/ as sysdba'directory=milk_dirdumpfile=mon_%U.dmplogfile ...

  7. Xcode下载模拟器太慢?

    在Xcode里下载模拟器,速度实在是太慢了.点击下载,卡住十几分钟才开始下载,并且龟速进行. 解决方案:获取模拟器下载地址,自己选择下载器进行下载. 找到下载链接 打开 Console.app(苹果电 ...

  8. postgreSQL PL/SQL编程学习笔记(三)——游标(Cursors)

    Cursors Rather than executing a whole query at once, it is possible to set up a cursor that encapsul ...

  9. 解决sql脚本文件太大无法打开的问题

    as we known,sql数据库高版本向低版本还原是不太可能但是又经常会碰到的事,今天实测了一种方法 步骤:任务—>生成脚本—> 下一步->高级,选择数据库版本和编写脚本数据类型 ...

随机推荐

  1. python post 发送字符串

    python post 发送一段字符串 把字符串写在表单里,表单用字典格式,字符串作value import requests data={key:str} r=requests.post(url,d ...

  2. thinkphp中的exp查询

    今天遇到一个问题,就是在vendor表中查询出vendor_id = vendor_f_id的数据,其实使用原生的sql语句是非常简单的: select * from vendor where ven ...

  3. Timus 1712. Cipher Grille 题解

    版权声明:本文作者靖心,靖空间地址:http://blog.csdn.net/kenden23/.未经本作者同意不得转载. https://blog.csdn.net/kenden23/article ...

  4. centons6升级gcc和glibc版本

    一.先升级gcc 这里配置yum源来升级 centos6系列更换阿里yum源 1.首先备份原来的cent os官方yum源 cp /etc/yum.repos.d/CentOS-Base.repo / ...

  5. bzoj2582 [Usaco2012Jan]Bovine Alliance

    [Usaco2012Jan]Bovine Alliance Time Limit: 2 Sec Memory Limit: 128 MB Description Bessie and her bovi ...

  6. js 对象 window,parent,top,opener,document

    Js 对象 window top parentWindow 当前html 页面Parent 当前html 页面的父页面Top 当前html页面的祖页面Window ==parent = top 当前页 ...

  7. Java compiler level does not match the version of the installed Java project facet错误

    出现问题情景:从其他地方导入一个项目的时候报错:Java compiler level does not match the version of the installed Java project ...

  8. size - 列出段节大小和总共大小

    总览 (SYNOPSIS) size [-A|-B|--format=compatibility] [--help] [-d|-o|-x|--radix=number] [--target=bfdna ...

  9. (PASS)PLSQL激活

    注册码: Product Code(产品编号):4t46t6vydkvsxekkvf3fjnpzy5wbuhphqz serial Number(序列号):601769 password(口令):xs ...

  10. WaitForSingleObject的作用[转]

    在多线程的情况下,有时候我们会希望等待某一线程完成了再继续做其他事情(比如主线程等待子线程结束完之后,自己再结束),要实现这个目的,可以使用Windows API函数WaitForSingleObje ...