Lately I have been writing a lot of literate sysadmining, writing down my thoughts as I explore systems by executing commands on them. This means that I end up writing the following boilerplate over and over again:
#+begin_src bash :dir /ssh:<some-remote-machine>:/
#+end_src
I usually just copy this snippet and bring it back from the kill ring whenever needed, but it grows tiresome if you mix this with other operations that populate the kill ring.
It would be handy if I could bring this back using some keybinding or snippet. The shell of a yasnippet doing this would look like:
#+begin_src ${1: `(some (code (finding-the-last-used-header-args)))`
#+end_src
But for my specific purposes perhaps having only the hostname being picked up would be better, like:
#+begin_src bash :dir /ssh:${1: `(code-finding-the-hostname)`:/
#+end_src
The result of invoking either one of these snippets in the same buffer as the first code example but below it would result in the exact same text being produced again.
I hope this explains what I'm looking for well enough.