Add generic TODO snippet using commentstring

This commit is contained in:
2016-04-17 13:04:34 +01:00
parent 437476694c
commit 9ff37a4055
4 changed files with 21 additions and 24 deletions

View File

@@ -1,3 +1,22 @@
snippet tab "Insert tab literal"
$0
endsnippet
global !p
comment=vim.current.buffer.options['commentstring'].strip()
def commentbefore():
return comment[0:comment.find('%s')].strip() + ' '
def commentafter():
after=comment[comment.find('%s')+2:].strip()
if 0 < len(after):
return ' ' + after
return ''
endglobal
snippet todo "TODO commment"
`!p snip.rv=commentbefore()`TODO$1: $0`!p snip.rv=commentafter()`
endsnippet
snippet note "NOTE comment"
`!p snip.rv=commentbefore()`NOTE: $0`!p snip.rv=commentafter()`
endsnippet