]> git.sev.monster Git - dotfiles.git/blame - .vim/syntax/python/todo.py
initial commit
[dotfiles.git] / .vim / syntax / python / todo.py
CommitLineData
1b8a4102 1#!/usr/bin/env python2
2# -*- coding: utf-8 -*-
3# File: todo.py
4# Description: Todo.txt overdue date syntax script
5# License: Vim license
6# Website: http://github.com/freitass/todo.txt-vim
7# Version: 0.1
8
9import vim
10import os
11import sys
12from datetime import date
13
14dateregex_dir = os.path.join(vim.eval('s:script_dir'), 'dateregex')
15if os.path.isdir(dateregex_dir):
16 sys.path.insert(0, dateregex_dir)
17
18def add_due_date_syntax_highlight():
19 try:
20 from dateregex import regex_date_before
21 except ImportError:
22 print("dateregex module not found. Overdue dates won't be highlighted")
23 return
24
25 regex = regex_date_before(date.today())
26 regex = r'(^|<)due:%s(>|$)' % regex
27
28 vim.command("syntax match OverDueDate '\\v%s'" % regex)
29 vim.command("highlight default link OverDueDate Error")
30
31add_due_date_syntax_highlight()
This page took 0.031615 seconds and 4 git commands to generate.