是否存在类似于通过点击C-w之后将点插入到isearch查询中C-s但是对于替换字符串(并替换regexp)查询?
我也很喜欢Sacha Chua修改C-x插入整个单词到isearch:
http://sachachua.com/blog/2008/07/emacs-keyboard-shortcuts-for-navigating-code/
如果可以在替换字符串中使用它,这在某些情况下也非常有用.
我会非常感谢任何提示!谢谢!
这样做,虽然它不像C-wisearch 那样花哨,因为你无法继续按下该键来扩展选择:
(defun my-minibuffer-insert-word-at-point ()
"Get word at point in original buffer and insert it to minibuffer."
(interactive)
(let (word beg)
(with-current-buffer (window-buffer (minibuffer-selected-window))
(save-excursion
(skip-syntax-backward "w_")
(setq beg (point))
(skip-syntax-forward "w_")
(setq word (buffer-substring-no-properties beg (point)))))
(when word
(insert word))))
(defun my-minibuffer-setup-hook ()
(local-set-key (kbd "C-w") 'my-minibuffer-insert-word-at-point))
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
Run Code Online (Sandbox Code Playgroud)
编辑: 请注意,这是在标准迷你缓冲区中,因此您可以使用它在任何有迷你缓冲区提示的地方使用它,例如在grep中,发生等等.