diff --git a/emacs/.emacs.d/config/init-built-ins.el b/emacs/.emacs.d/config/init-built-ins.el index 3e740f6..d2b3307 100644 --- a/emacs/.emacs.d/config/init-built-ins.el +++ b/emacs/.emacs.d/config/init-built-ins.el @@ -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) diff --git a/emacs/.emacs.d/config/init-completion.el b/emacs/.emacs.d/config/init-completion.el index 51ebd8f..b683b3f 100644 --- a/emacs/.emacs.d/config/init-completion.el +++ b/emacs/.emacs.d/config/init-completion.el @@ -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)