From 85c215b4ccaed37382ad659180385534734e1cf0 Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Mon, 5 Sep 2016 15:31:10 +0200 Subject: [PATCH] Use python3 if available This commit incorporates [fievel's work](https://github.com/fievel/todo.txt-vim/commit/0863e1434e9a89ace06c4856b6cb32ba9906e3de) to use python3 if possible. I have not personally test vim+python3 but overdue dates still works with python2. --- syntax/python/dateregex/dateregex/before.py | 2 ++ syntax/todo.vim | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/syntax/python/dateregex/dateregex/before.py b/syntax/python/dateregex/dateregex/before.py index 0e8cb96..fe91c74 100644 --- a/syntax/python/dateregex/dateregex/before.py +++ b/syntax/python/dateregex/dateregex/before.py @@ -24,6 +24,7 @@ def _year_regex_before(year): year_regex += ')' return '-'.join((year_regex, r'\d{2}', r'\d{2}')) + def _month_regex_before(year, month): if month == '01': return None @@ -63,6 +64,7 @@ def _day_regex_before(year, month, day): + def regex_date_before(given_date): year, month, day = given_date.isoformat().split('-') diff --git a/syntax/todo.vim b/syntax/todo.vim index e8ad616..551b780 100644 --- a/syntax/todo.vim +++ b/syntax/todo.vim @@ -53,10 +53,10 @@ highlight default link TodoContext Special let b:curdir = expand(':p:h') let s:script_dir = b:curdir . "/python/" -if has('python') - execute "pyfile " . s:script_dir. "todo.py" -elseif has('python3') +if has('python3') execute "py3file " . s:script_dir. "todo.py" +elseif has('python') + execute "pyfile " . s:script_dir. "todo.py" endif let b:current_syntax = "todo"