Move python scripts to syntax/

This commit is contained in:
Guilherme Victal
2016-01-24 17:22:24 -02:00
parent 6e1bcc0e1a
commit 7232106f45
4 changed files with 4 additions and 30 deletions

4
.gitmodules vendored
View File

@@ -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

View File

@@ -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()

View File

@@ -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