88 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
priority -1
 | 
						|
 | 
						|
snippet me "Identify me"
 | 
						|
Kenneth Benzie (Benie) <k.benzie83@gmail.com>
 | 
						|
endsnippet
 | 
						|
 | 
						|
global !p
 | 
						|
comment=vim.current.buffer.options['commentstring'].strip()
 | 
						|
 | 
						|
def commentbefore():
 | 
						|
	commentbefore = comment[0:comment.find('%s')].strip()
 | 
						|
	row, col = vim.current.window.cursor
 | 
						|
	row -= 1
 | 
						|
	col -= 1
 | 
						|
	line = vim.current.buffer[row]
 | 
						|
	if (col - 1) >= 0 and commentbefore == line[col - 1:len(commentbefore)]:
 | 
						|
		return ''
 | 
						|
	return commentbefore + ' '
 | 
						|
 | 
						|
def commentafter():
 | 
						|
	after=comment[comment.find('%s')+2:].strip()
 | 
						|
	if 0 < len(after):
 | 
						|
		return ' ' + after
 | 
						|
	return ''
 | 
						|
 | 
						|
import datetime
 | 
						|
import time
 | 
						|
 | 
						|
def date():
 | 
						|
	return datetime.datetime.now().strftime('%B %d, %Y')
 | 
						|
 | 
						|
class LocalTZ(datetime.tzinfo):
 | 
						|
	"""Query OS for local timezone offset."""
 | 
						|
 | 
						|
	def __init__(self):
 | 
						|
		"""Initialize LocalTZ."""
 | 
						|
		datetime.tzinfo.__init__(self)
 | 
						|
		self._unixEpochOrdinal = datetime.datetime.utcfromtimestamp(
 | 
						|
			0).toordinal()
 | 
						|
 | 
						|
	def dst(self, _):
 | 
						|
		return datetime.timedelta(0)
 | 
						|
 | 
						|
	def utcoffset(self, dt):
 | 
						|
		t = ((dt.toordinal() - self._unixEpochOrdinal) * 86400 + dt.hour * 3600
 | 
						|
			 + dt.second + time.timezone)
 | 
						|
		utc = datetime.datetime(*time.gmtime(t)[:6])
 | 
						|
		local = datetime.datetime(*time.localtime(t)[:6])
 | 
						|
		return local - utc
 | 
						|
 | 
						|
def utc():
 | 
						|
	value = datetime.datetime.strftime(
 | 
						|
		datetime.datetime.now(LocalTZ()), '%Y-%m-%dT%H:%M:%S%z')
 | 
						|
	return '%s:%s' % (value[:-2], value[-2:])
 | 
						|
endglobal
 | 
						|
 | 
						|
snippet date "Today's date"
 | 
						|
`!p snip.rv=date()`
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet utc "UTC date time now" i
 | 
						|
`!p snip.rv=utc()`
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet todo "TODO commment"
 | 
						|
`!p snip.rv=commentbefore()`TODO${1/.+/(/}$1${1/.+/)/}: $0`!p snip.rv=commentafter()`
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet note "NOTE comment"
 | 
						|
`!p snip.rv=commentbefore()`NOTE: $0`!p snip.rv=commentafter()`
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet *x "GitHub style checkbox"
 | 
						|
* [${1: }] $0
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet "* [" "GitHub style checkbox"
 | 
						|
* [${1: }] $0
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet *[ "GitHub style checkbox"
 | 
						|
* [${1: }] $0
 | 
						|
endsnippet
 | 
						|
 | 
						|
snippet [[ "lit named ID match" i
 | 
						|
[[${1:name}:%[a-zA-Z0-9]+]]
 | 
						|
endsnippet
 |