【问题标题】:replace the string all over buffer emacs替换整个缓冲区emacs中的字符串
【发布时间】:2014-10-29 14:16:24
【问题描述】:

我使用M-x replace-stringM-% 替换emacs 缓冲区中的字符串。

它们的问题是它们只能从缓冲区的当前位置向前替换字符串。我怎样才能在整个缓冲区中强制它?

我不想做M-< 到达起点然后去做。

【问题讨论】:

标签: search emacs replace emacs24


【解决方案1】:

看起来这是不可能交互的。所以让我们一起搭建一些 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) 的文档告诉我们它可以采用可选参数开始和结束替换。

更多文档:

【讨论】:

  • 感谢您告诉我如何找出这些东西 :)
猜你喜欢
  • 2015-02-03
  • 2011-10-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多