zoukankan      html  css  js  c++  java
  • multiple-cursors实在是太好用了

    multiple-cursors实在是太好用了

    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

  • 相关阅读:
    把数据库转化成数据库脚本
    营养瘦身第一菜——金陵素什锦 健康程序员,至尚生活!
    十类好吃不胖的食物 健康程序员,至尚生活!
    一周带饭实录(附作菜菜谱) 健康程序员,至尚生活!
    日常五大习惯有助减肥 健康程序员,至尚生活!
    【暴强】200种好口碑便宜护肤品 健康程序员,至尚生活!
    腹式肠道操 缩胃瘦身有奇效 健康程序员,至尚生活!
    一天4时段喝水轻松瘦身 健康程序员,至尚生活!
    10种不要钱的护肤法则 健康程序员,至尚生活!
    看了这篇你肯定瘦 全身上下想瘦哪就瘦哪 健康程序员,至尚生活!
  • 原文地址:https://www.cnblogs.com/yangwen0228/p/6384623.html
Copyright © 2011-2022 走看看