define-command \ -docstring %{ Replace the selections with the date, with the args passed as a string to date -d. } \ insert-date -params 0.. %{ evaluate-commands -draft -save-regs '|"' %{ set-register | "date -d '%arg{@}' '+%%Y-%%m-%%d' | tr -d '\n'" echo -debug "Inserting date: %reg{pipe}" # we delete the trailing newline execute-keys '|' } } alias global date insert-date