【发布时间】:2014-10-29 14:16:24
【问题描述】:
我使用M-x replace-string 或M-% 替换emacs 缓冲区中的字符串。
它们的问题是它们只能从缓冲区的当前位置向前替换字符串。我怎样才能在整个缓冲区中强制它?
我不想做M-< 到达起点然后去做。
【问题讨论】:
-
查看this question的答案。
标签: search emacs replace emacs24
我使用M-x replace-string 或M-% 替换emacs 缓冲区中的字符串。
它们的问题是它们只能从缓冲区的当前位置向前替换字符串。我怎样才能在整个缓冲区中强制它?
我不想做M-< 到达起点然后去做。
【问题讨论】:
标签: search emacs replace emacs24
看起来这是不可能交互的。所以让我们一起搭建一些 Elisp。
(defun my-replace-allbuffer (str-orig str-replace)
(interactive "sString ? \nsReplace with ? ")
(replace-string str-orig str-replace nil (point-min) (point-max))
)
并将函数绑定到您喜欢的键绑定。
replace-string (C-h f replace-string RET) 的文档告诉我们它可以采用可选参数开始和结束替换。
更多文档:
【讨论】: