2 # -*- coding: utf-8 -*-
4 # Description: Todo.txt overdue date syntax script
6 # Website: http://github.com/freitass/todo.txt-vim
12 from datetime import date
14 dateregex_dir = os.path.join(vim.eval('s:script_dir'), 'dateregex')
15 if os.path.isdir(dateregex_dir):
16 sys.path.insert(0, dateregex_dir)
18 def add_due_date_syntax_highlight():
20 from dateregex import regex_date_before
22 print("dateregex module not found. Overdue dates won't be highlighted")
25 regex = regex_date_before(date.today())
26 regex = r'(^|<)due:%s(>|$)' % regex
28 vim.command("syntax match OverDueDate '\\v%s'" % regex)
29 vim.command("highlight default link OverDueDate Error")
31 add_due_date_syntax_highlight()