Just a tiny post to share a command I use since a quite of time now to grep time ranges, notably the things to do over 7 days.
:grep %sh(p today .. 7 days | cr 'todo.+%F' -j '|')
p is an alias to
The search output will look something like:
With the following document, it will match the “today” and “in 7 days” occurrences, but not “yesterday” and “in 14 days”.
TODO 2020-11-19 Something (Yesterday) ... TODO 2020-11-20 Something (Today) ... TODO 2020-11-27 Something (in 7 days) ... TODO 2020-12-04 Something (in 14 days)
If you want something else than days you can configure the range step in days (
-d), hours (
-h), minutes (
-m) and seconds (
You can also do some maths, such as:
p today + 14 days | cr # 2020-11-27 17:03:05
Which is quite useful if you want to search dates from the prompt.
/%sh(cr -i 'next monday' '%F')<a-!><ret>
<a-!> is to expand typed expansions (here a shell block).
TODO [2020-12-04] Something (in 14 days)
/%sh(cr -i "$kak_selection + 7 days" '%F')<a-!><ret>
will jump to
-i option, you have
%s available if you need to map
p 2020-12-25 | cr -i '%s + tomorrow' '%F' # 2020-12-26
In Kakoune, you can select dates and map them to other formats.
For example, select:
Oct 8, 2020