2016-10-21 14:32:17 +03:00
|
|
|
# https://www.taskpaper.com
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global BufCreate .*\.taskpaper %{
|
2017-11-03 10:34:41 +03:00
|
|
|
set-option buffer filetype taskpaper
|
2016-10-21 14:32:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-07-01 12:53:35 +03:00
|
|
|
add-highlighter shared/taskpaper group
|
2016-10-21 14:32:17 +03:00
|
|
|
|
2018-07-01 12:53:35 +03:00
|
|
|
add-highlighter shared/taskpaper/ regex ^\h*([^:\n]+):\h*\n 1:header
|
|
|
|
add-highlighter shared/taskpaper/ regex \h@\w+(?:\(([^)]*)\))? 0:variable 1:value
|
|
|
|
add-highlighter shared/taskpaper/ regex ^\h*([^-:\n]+)\n 1:+i
|
|
|
|
add-highlighter shared/taskpaper/ regex ^\h*-\h+[^\n]*@done[^\n]* 0:+d
|
|
|
|
add-highlighter shared/taskpaper/ regex (([a-z]+://\S+)|((mailto:)[\w+-]+@\S+)) 0:link
|
2016-10-21 14:32:17 +03:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
# ‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-11-03 10:34:41 +03:00
|
|
|
define-command -hidden taskpaper-indent-on-new-line %{
|
2017-11-03 11:09:45 +03:00
|
|
|
evaluate-commands -draft -itersel %{
|
2016-10-21 14:32:17 +03:00
|
|
|
# preserve previous line indent
|
2017-11-03 11:09:45 +03:00
|
|
|
try %{ execute-keys -draft \;K<a-&> }
|
2016-10-21 14:32:17 +03:00
|
|
|
## If the line above is a project indent with a tab
|
2017-11-03 11:09:45 +03:00
|
|
|
try %{ execute-keys -draft Z k<a-x> <a-k>^\h*([^:\n]+):<ret> z i<tab> }
|
2016-10-21 14:32:17 +03:00
|
|
|
# cleanup trailing white spaces on previous line
|
2017-11-03 11:09:45 +03:00
|
|
|
try %{ execute-keys -draft k<a-x> s \h+$ <ret>d }
|
2016-10-21 14:32:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{
|
2018-07-01 12:53:35 +03:00
|
|
|
add-highlighter window/taskpaper ref taskpaper
|
2018-12-11 02:11:35 +03:00
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/taskpaper }
|
2016-10-21 14:32:17 +03:00
|
|
|
}
|
2018-11-28 12:39:18 +03:00
|
|
|
|
|
|
|
hook global WinSetOption filetype=taskpaper %{
|
|
|
|
hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line
|
2018-12-11 02:11:35 +03:00
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window taskpaper-.+ }
|
2016-10-21 14:32:17 +03:00
|
|
|
}
|