2016-10-21 13:32:17 +02:00
|
|
|
# https://www.taskpaper.com
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global BufCreate .*\.taskpaper %{
|
|
|
|
set buffer filetype taskpaper
|
|
|
|
}
|
|
|
|
|
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-10-28 05:00:51 +02:00
|
|
|
add-highlighter shared/ group taskpaper
|
2016-10-21 13:32:17 +02:00
|
|
|
|
2017-10-28 05:00:51 +02: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 13:32:17 +02:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
# ‾‾‾‾‾‾‾‾
|
|
|
|
|
2017-01-13 01:56:30 +01:00
|
|
|
def -hidden taskpaper-indent-on-new-line %{
|
2016-10-21 13:32:17 +02:00
|
|
|
eval -draft -itersel %{
|
|
|
|
# preserve previous line indent
|
|
|
|
try %{ exec -draft \;K<a-&> }
|
|
|
|
## If the line above is a project indent with a tab
|
|
|
|
try %{ exec -draft Z k<a-x> <a-k>^\h*([^:\n]+):<ret> z i<tab> }
|
|
|
|
# cleanup trailing white spaces on previous line
|
|
|
|
try %{ exec -draft k<a-x> s \h+$ <ret>d }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{
|
2017-10-28 05:00:51 +02:00
|
|
|
add-highlighter window ref taskpaper
|
2017-01-13 01:56:30 +01:00
|
|
|
hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line
|
2016-10-21 13:32:17 +02:00
|
|
|
}
|
|
|
|
hook -group taskpaper-highlight global WinSetOption filetype=(?!taskpaper).* %{
|
2017-10-28 05:00:51 +02:00
|
|
|
remove-highlighter window/taskpaper
|
2017-01-04 01:07:45 +01:00
|
|
|
remove-hooks window taskpaper-indent
|
2016-10-21 13:32:17 +02:00
|
|
|
}
|