mirror of
https://github.com/freitass/todo.txt-vim.git
synced 2025-11-17 14:23:39 -05:00
Move python scripts to syntax/
This commit is contained in:
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "python/dateregex"]
|
[submodule "python/dateregex"]
|
||||||
path = python/dateregex
|
path = syntax/python/dateregex
|
||||||
url = git@github.com:victal/dateregex.git
|
url = https://github.com/victal/dateregex.git
|
||||||
|
|||||||
Submodule python/dateregex deleted from 7db2e6ca01
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env python2
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import vim
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from datetime import date
|
|
||||||
|
|
||||||
dateregex_dir = os.path.join(vim.eval('s:script_dir'), 'dateregex')
|
|
||||||
if os.path.isdir(dateregex_dir):
|
|
||||||
sys.path.insert(0, dateregex_dir)
|
|
||||||
|
|
||||||
def add_due_date_syntax_highlight():
|
|
||||||
try:
|
|
||||||
from dateregex import regex_date_before
|
|
||||||
except ImportError:
|
|
||||||
print("dateregex module not found. Overdue dates won't be highlighted")
|
|
||||||
return
|
|
||||||
|
|
||||||
regex = regex_date_before(date.today())
|
|
||||||
regex = r'(^|<)due:%s(>|$)' % regex
|
|
||||||
|
|
||||||
vim.command("syntax match OverDueDate '\\v%s'" % regex)
|
|
||||||
vim.command("highlight default link OverDueDate Error")
|
|
||||||
|
|
||||||
add_due_date_syntax_highlight()
|
|
||||||
@@ -52,8 +52,8 @@ highlight default link TodoContext Special
|
|||||||
|
|
||||||
if has('python')
|
if has('python')
|
||||||
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/"
|
||||||
execute "pyfile " . b:curdir . "/../python/todo.py"
|
execute "pyfile " . s:script_dir. "todo.py"
|
||||||
else
|
else
|
||||||
echom "Your version of vim has no python support. Overdue dates won't be highlighted"
|
echom "Your version of vim has no python support. Overdue dates won't be highlighted"
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user