Add command to browse a URL or google the symbol at point

This commit is contained in:
Jeremy Dormitzer 2024-05-10 16:06:23 -04:00
parent 232f8053f0
commit da98498fd4
2 changed files with 11 additions and 0 deletions

View File

@ -70,4 +70,14 @@
:general
([remap dabbrev-expand] #'hippie-expand))
(use-package browse-url
:straight (:type built-in)
:config
(defun browse-url-or-search (url-or-symbol)
"If URL-OR-SYMBOL is a URL, browse it. Otherwise, search for it."
(interactive (list (thing-at-point 'symbol)))
(if (ffap-url-p url-or-symbol)
(browse-url url-or-symbol)
(browse-url (format "https://www.google.com/search?q=%s" url-or-symbol)))))
(provide 'init-built-ins)

View File

@ -145,6 +145,7 @@ targets."
((emacs normal motion insert visual) "M-." #'embark-dwim)
("C-." #'embark-act)
("M-." #'embark-dwim)
(embark-general-map "C-k" #'browse-url-or-search)
(embark-file-map "s" #'sudo-edit-find-file
"l" #'vlf
"g" #'magit-file-dispatch)