declare-option bool gtd
hook global BufCreate '.*/diary/\d{4}\.md' %{
set-option buffer gtd yes
}
hook global WinSetOption gtd=true %{
require-module gtd
evaluate-commands set-option window static_words %opt{gtd_keywords}
add-highlighter window/ ref gtd
alias window gtd gtd-grep-todo
alias window g+ gtd-grep-scheduled
alias window g! gtd-grep-deadline
alias window g+h gtd-grep-hourly
alias window g+d gtd-grep-daily
alias window g+w gtd-grep-weekly
alias window g+m gtd-grep-monthly
alias window g+y gtd-grep-yearly
alias window td gtd-chronic-grep-today
alias window tw gtd-chronic-grep-week
map window normal <a-d> ': gtd-jump-to-day<ret>'
map window normal <c-d> ': gtd-todo-done<ret>'
map window normal <c-u> ': gtd-todo-cancelled<ret>'
map window insert <c-y> '<a-;>: gtd-insert-date<ret>'
map window insert <c-u> '<a-;>: gtd-insert-time<ret>'
hook -always -once window WinSetOption gtd=false %{
remove-highlighter window/gtd
}
}
provide-module gtd %š
declare-option -hidden str-list gtd_keywords 'Aborted' 'Cancelled' 'Constat' 'Deadline' 'Done' 'Fixed point' 'Habits' 'Postponed' 'Rule' 'Scheduled' 'Status' 'To do' 'Try' 'Waiting'
add-highlighter shared/gtd regions
add-highlighter shared/gtd/code default-region group
evaluate-commands %sh{
# Keywords
eval "set -- $kak_quoted_opt_gtd_keywords"
regex="\\b(?:\\Q$1\\E"
shift
for keyword do
regex="$regex|\\Q$keyword\\E"
done
regex="$regex)\\b"
printf "add-highlighter shared/gtd/code/keywords regex '%s' 0:keyword\n" "$regex"
}
define-command gtd-jump-to-day %{
set-register / "^# \K%sh(date '+%F\.%a')$"
execute-keys '<space>n'
set-register / '^# \K\d{4}-\d{2}-\d{2}\.\w{3}$'
}
define-command gtd-todo-done %{
execute-keys -draft '<a-x>sTo do<ret>cDone<esc>'
}
define-command gtd-todo-cancelled %{
execute-keys -draft '<a-x>sTo do<ret>cCancelled<esc>'
}
define-command gtd-grep-todo %(grep 'To do')
define-command gtd-grep-scheduled %(grep 'Scheduled')
define-command gtd-grep-deadline %(grep 'Deadline')
define-command gtd-grep-hourly %(grep '\+\d+Hours')
define-command gtd-grep-daily %(grep '\+\d+Days')
define-command gtd-grep-weekly %(grep '\+\d+Weeks')
define-command gtd-grep-monthly %(grep '\+\d+Months')
define-command gtd-grep-yearly %(grep '\+\d+Years')
define-command gtd-chronic-grep-today %(chronic-grep-period 'To do.+%F' today today day)
define-command gtd-chronic-grep-week %(chronic-grep-period 'To do.+%F' today week day)
define-command gtd-insert-date %(execute-keys -draft '!date ''+%F'' | tr -d ''\n''<ret>')
define-command gtd-insert-time %(execute-keys -draft '!date ''+%R'' | tr -d ''\n''<ret>')
š
interesting idea! Though Org mode is much more feature-full not everyone needs that amount of features. But the big thing for me was agenda that generates interactive list of tasks with times, dates, repeats, and so on. Glad to see some flavor of it in Kakoune!
The configuration is dense, but if I can spot some of my favorite parts, is the ability to grep things within a time range (the current day and week), and relative-to-absolute (ānext mondayā ā %F
ā ā2020-01-13ā) date formats.
This is really cool. Do you mind commenting a little more about the functionality here? Iām also really interested in seeing an example file.
Please post if you manage to figure it out! Iām really interested in a similar setup, but it would be great to see it in action. Thanks!
Iām currently busy to review my plugin implementations, but I will do when I have the time.
This looks very nice! Thanks for sharing.
This is awesome! Iām going to give it a go later. Thanks!