2
我使用M-x replace-string
或M-%
替换emacs缓冲区中的字符串。替换全部缓冲区的字符串emacs
问题在于它们只是从缓冲区的当前位置向前替换字符串。我如何强制它遍布缓冲区?
我不想做M-<
到达一开始,然后做到这一点。
我使用M-x replace-string
或M-%
替换emacs缓冲区中的字符串。替换全部缓冲区的字符串emacs
问题在于它们只是从缓冲区的当前位置向前替换字符串。我如何强制它遍布缓冲区?
我不想做M-<
到达一开始,然后做到这一点。
看起来像这是不可能交互。所以让我们一起提出一些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
)的文档告诉我们可以采用可选参数开始和结束替换。
更多DOC:
谢谢你告诉我如何找出这些东西:) – 2014-10-30 08:28:33
参见答案[这个问题](http://superuser.com/q/603185/4542)。 – legoscia 2014-10-29 14:33:50