Define an interactive function (aka command), which insert
s this string. Then put this function on a key binding.
(defun my-insert-regex ()
(interactive)
(insert (format "%S" markdown-link-to-org-regexp)))
(define-key global-map (kbd "C-c i") #'my-insert-regex)
When doing M-:
you then just have to press C-c i
to insert this string at the prompt.
Note, that your regex is eventualy wrong and needs more escape characters. re-builder
can help you construct this regex.
Second option:
This M-:
promt normaly supports a history. You just need to type or paste it once, then you can retrieve former inputs with <up>
and <down>
keys. C-r
searches backwards in the history. (C-r
maybe has a different keybinding in Doom, Evil).
C-y
) into the minibuffer?init.el
and the usage will happen when editing some org file and pasting some content from the internet. So the request is to bring to the minibuffer a predefined string from a variable.(defvar markdown-link-to-org-regexp "s/\\[\\(.+\\)\\](\\(.+\\))/[[\\2][\\1]]")
.