Add generic TODO snippet using commentstring
This commit is contained in:
@@ -2,8 +2,26 @@ 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 codeplay "Codeplay Software Ltd. copywrite"
|
||||
${1://} Copyright (C) 2002-2016 Codeplay Software Limited. All Rights Reserved.
|
||||
`!p snip.rv=commentbefore()`Copyright (C) 2002-2016 Codeplay Software Limited. All Rights Reserved.`!p snip.rv=commentafter()`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user