Use python3 if available

This commit incorporates [fievel's work](0863e1434e) to use python3 if possible.

I have not personally test vim+python3 but overdue dates still works with
python2.
This commit is contained in:
David Beniamine
2016-09-05 15:31:10 +02:00
parent 3e3251f8b5
commit 85c215b4cc
2 changed files with 5 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ def _year_regex_before(year):
year_regex += ')' year_regex += ')'
return '-'.join((year_regex, r'\d{2}', r'\d{2}')) return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
def _month_regex_before(year, month): def _month_regex_before(year, month):
if month == '01': if month == '01':
return None return None
@@ -63,6 +64,7 @@ def _day_regex_before(year, month, day):
def regex_date_before(given_date): def regex_date_before(given_date):
year, month, day = given_date.isoformat().split('-') year, month, day = given_date.isoformat().split('-')

View File

@@ -53,10 +53,10 @@ highlight default link TodoContext Special
let b:curdir = expand('<sfile>:p:h') let b:curdir = expand('<sfile>:p:h')
let s:script_dir = b:curdir . "/python/" let s:script_dir = b:curdir . "/python/"
if has('python') if has('python3')
execute "pyfile " . s:script_dir. "todo.py"
elseif has('python3')
execute "py3file " . s:script_dir. "todo.py" execute "py3file " . s:script_dir. "todo.py"
elseif has('python')
execute "pyfile " . s:script_dir. "todo.py"
endif endif
let b:current_syntax = "todo" let b:current_syntax = "todo"