是否有可能在点击Cs
时搜索当前存在于剪贴板中的文本,可能是在点击Cs
时触发了某种钩子然后将剪贴板插入到迷你缓冲区中?
Isearch provides a set of standard keys to change the behaviour of the search process. Typing Cs My invokes isearch-yank-kill
that pulls string from kill ring (ie, clipboard) into search string.
You could yank the text after starting isearch:
(defun my-isearch-yank-clipboard ()
(interactive)
(isearch-yank-string (or (x-get-selection 'PRIMARY)
(x-get-selection 'CLIPBOARD)
"")))
(define-key isearch-mode-map (kbd "M-s c") 'my-isearch-yank-clipboard)
Start isearch then "Ms c"
您可以使用defadvice来改变命令isearch-forward的行为,默认情况下绑定到Cs,或者定义另一个可能包含isearch-forward并将其绑定到Cs而不是isearch-forward的函数。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.