As suggested by the Org-mode Manual, I've customized
org-link-abbrev-alist as follows:
(setq org-link-abbrev-alist '(;; Abbreviations for websites ("google" . "https://www.google.com/#q=") ("github" . "https://www.github.com/")))
This is convenient because I can easily insert a link with:
[[google:cat pictures][Google Search for cat pictures]]
This is useful because if the URL changes, I can just updated
org-link-abbrev-alist. However, there are instances in the past where I've used the entire non-abbreviated link or decided, after visiting a website enough times, to create an abbreviation.
How would I write a function to use
org-link-abbrev-alist to turn long form links in all org-mode files (say, all files in
org-agenda-files to abbreviated links? For example,
[[https://www.google.com/#q=cat pictures][Google search for cat pictures]]
[[google:cat pictures][Google search for cat pictures]]
I'd also like to integrate this function with
org-mode-hook so that it happens automatically on either save or startup.
Lastly, I'd also like a function that does the reverse and replaces the abbreviation with the long form link.