dotfiles/.config/kak/autoload/util.kak

15 lines
431 B
Text

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 '|<ret>'
}
}
alias global date insert-date