29 lines
766 B
Text
29 lines
766 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
|
|
|
|
define-command -params 2 \
|
|
-docstring %{
|
|
Swap all occurence of param A with param B in selections.
|
|
} \
|
|
sedswap %{
|
|
evaluate-commands -save-regs | %{
|
|
set-register | %exp{
|
|
sed "s/%arg{1}/__FOOTOKEN__/; \
|
|
s/%arg{2}/%arg{1}/; s/__FOOTOKEN__/%arg{2}/"
|
|
}
|
|
execute-keys '|<ret>'
|
|
}
|
|
}
|