如何使用 helm-ag-edit 和 helm-swoop-edit 启用 evil-mc?

How to enable evil-mc with helm-ag-edit and helm-swoop-edit?

我想在 helm-ag-edithelm-swoop-edit 的缓冲区中使用多个游标。但它无法自动启用 evil-mc-mode。我补充说:

(dolist (buffer '("*helm-ag-edit*" "*Helm Swoop Edit*"))
  (when (get-buffer buffer)
    (with-current-buffer buffer
      (evil-mc-mode 1))))

很遗憾,没有任何效果。那么如何使用这两个缓冲区自动启用evil-mc-mode

希望我的回复还不算太晚。 我遇到了同样的问题,终于意识到我根本不需要evil-mc! 这就是我使用 *-edit 缓冲区的方式:

  • 调用 helm-ag,helm-swoop
  • C-c C-e 进入 *-edit 缓冲区的编辑
  • M%
  • 插入查询字符串及其替换(使用 M-n 导航提示的历史记录并获取已用于搜索操作的字符串)
  • 退学
  • y 替换一场比赛
  • n 跳过一场比赛
  • !替换所有剩余的匹配项

优点:您不必跳转到字符串位置

缺点:您必须指定字符串及其替换

提示:按 ?查看 *-edit 缓冲区手册

Emacs 真棒!

解决此问题的另一个答案:

 (advice-add 'helm-swoop--edit :after #'evil-mc-mode)
 (advice-add 'helm-ag--edit :after #'evil-mc-mode)