写配置看到了 webjump,可以定义一些搜索链接,选择预置的链接,输入关键字进行搜索(利用 brower-url)。
我觉得用来搜索 point 下的内容也挺好的,就糊了个简单函数,用来搜索 symbol-at-point 的内容,例如用 Kagi 搜索、Kagi 翻译、搜索 GitHub、MDN 等常用文档。
不知道有没有已经存在的包实现了类似功能,没怎么找,有的话也欢迎分享。
效果:

代码
(use-package webjump
:bind (("C-M-?" . spike-leung/webjump-symbol-at-point))
:config
(setq webjump-sites '(("Kagi" . [simple-query "kagi.com" "kagi.com/search?q=" ""])
("Kagi Translate" . [simple-query "translate.kagi.com" "translate.kagi.com/?from=auto&to=zh_cn&text=" ""])
("Wikipedia" . [simple-query "wikipedia.org" "wikipedia.org/wiki/" ""])
("GitHub" . [simple-query "github.com" "github.com/search?q=" ""])
("MDN" . [simple-query "developer.mozilla.org" "developer.mozilla.org/en-US/search?q=" ""])))
(defun spike-leung/webjump-symbol-at-point ()
"获取光标下的 symbol 并通过 webjump 搜索。"
(interactive)
(let* ((completion-ignore-case t)
(content (if (use-region-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(thing-at-point 'symbol t)))
(query (read-string (format "Webjump search (%s): " (or content ""))
nil nil content))
(item (assoc-string
(completing-read "WebJump to site: " webjump-sites nil t)
webjump-sites t))
(name (car item))
(expr (cdr item))
(query-prefix (aref expr 2))
(query-suffix (aref expr 3))
(fun (if webjump-use-internal-browser
(apply-partially #'browse-url-with-browser-kind 'internal)
#'browse-url)))
(funcall fun (webjump-url-fix
(cond ((concat query-prefix (webjump-url-encode query) query-suffix))
(t (error "WebJump URL expression for \"%s\" invalid"
name))))))))