feat(org): bind <localleader> l y to +org/yank-link

For copying the URL component of an org link at point.
This commit is contained in:
Henrik Lissner 2024-07-11 15:17:25 -04:00
parent ba467fea57
commit 250f3a3899
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 10 additions and 0 deletions

View file

@ -411,6 +411,15 @@ exist, and `org-link' otherwise."
(delete-region (match-beginning 0) (match-end 0)) (delete-region (match-beginning 0) (match-end 0))
(insert label)))) (insert label))))
;;;###autoload
(defun +org/yank-link ()
"Copy the url at point to the clipboard.
If on top of an Org link, will only copy the link component."
(interactive)
(let ((url (thing-at-point 'url)))
(kill-new (or url (user-error "No URL at point")))
(message "Copied link: %s" url)))
;;;###autoload ;;;###autoload
(defun +org/play-gif-at-point () (defun +org/play-gif-at-point ()
"TODO" "TODO"

View file

@ -988,6 +988,7 @@ between the two."
"s" #'org-store-link "s" #'org-store-link
"S" #'org-insert-last-stored-link "S" #'org-insert-last-stored-link
"t" #'org-toggle-link-display "t" #'org-toggle-link-display
"y" #'+org/yank-link
(:when (modulep! :os macos) (:when (modulep! :os macos)
"g" #'org-mac-link-get-link)) "g" #'org-mac-link-get-link))
(:prefix ("P" . "publish") (:prefix ("P" . "publish")