]>
Commit | Line | Data |
---|---|---|
1 | " File: todo.txt.vim | |
2 | " Description: Todo.txt syntax settings | |
3 | " Author: Leandro Freitas <freitass@gmail.com> | |
4 | " License: Vim license | |
5 | " Website: http://github.com/freitass/todo.txt-vim | |
6 | " Version: 0.3 | |
7 | ||
8 | if exists("b:current_syntax") | |
9 | finish | |
10 | endif | |
11 | ||
12 | syntax match TodoDone '^[xX]\s.\+$' | |
13 | syntax match TodoPriorityA '^([aA])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
14 | syntax match TodoPriorityB '^([bB])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
15 | syntax match TodoPriorityC '^([cC])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
16 | syntax match TodoPriorityD '^([dD])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
17 | syntax match TodoPriorityE '^([eE])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
18 | syntax match TodoPriorityF '^([fF])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
19 | syntax match TodoPriorityG '^([gG])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
20 | syntax match TodoPriorityH '^([hH])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
21 | syntax match TodoPriorityI '^([iI])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
22 | syntax match TodoPriorityJ '^([jJ])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
23 | syntax match TodoPriorityK '^([kK])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
24 | syntax match TodoPriorityL '^([lL])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
25 | syntax match TodoPriorityM '^([mM])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
26 | syntax match TodoPriorityN '^([nN])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
27 | syntax match TodoPriorityO '^([oO])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
28 | syntax match TodoPriorityP '^([pP])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
29 | syntax match TodoPriorityQ '^([qQ])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
30 | syntax match TodoPriorityR '^([rR])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
31 | syntax match TodoPriorityS '^([sS])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
32 | syntax match TodoPriorityT '^([tT])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
33 | syntax match TodoPriorityU '^([uU])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
34 | syntax match TodoPriorityV '^([vV])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
35 | syntax match TodoPriorityW '^([wW])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
36 | syntax match TodoPriorityX '^([xX])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
37 | syntax match TodoPriorityY '^([yY])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
38 | syntax match TodoPriorityZ '^([zZ])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate | |
39 | ||
40 | syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=NONE | |
41 | syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=NONE | |
42 | syntax match TodoContext '\(^\|\W\)@[^[:blank:]]\+' contains=NONE | |
43 | ||
44 | " Other priority colours might be defined by the user | |
45 | highlight default link TodoDone Comment | |
46 | highlight default link TodoPriorityA Constant | |
47 | highlight default link TodoPriorityB Statement | |
48 | highlight default link TodoPriorityC Identifier | |
49 | highlight default link TodoDate PreProc | |
50 | highlight default link TodoProject Special | |
51 | highlight default link TodoContext Special | |
52 | ||
53 | if exists('g:todo_load_python') && g:todo_load_python | |
54 | if has('python') | |
55 | let b:curdir = expand('<sfile>:p:h') | |
56 | let s:script_dir = b:curdir . "/python/" | |
57 | execute "pyfile " . s:script_dir. "todo.py" | |
58 | elseif has('python3') | |
59 | let b:curdir = expand('<sfile>:p:h') | |
60 | let s:script_dir = b:curdir . "/python/" | |
61 | execute "py3file " . s:script_dir. "todo.py" | |
62 | else | |
63 | echom "Your version of vim has no python support. Overdue dates won't be highlighted" | |
64 | endif | |
65 | endif | |
66 | ||
67 | let b:current_syntax = "todo" |