4 def _parse_comments(s):
5 """ Parses vim's comments option to extract comment format """
11 # get the flags and text of a comment part
12 flags, text = next(i).split(':', 1)
15 rv.append((text, text, text, text, ""))
16 # parse 3-part comment, but ignore those with O flag
17 elif 's' in flags and 'O' not in flags:
21 if flags[-1] in string.digits:
22 indent = " " * int(flags[-1])
25 flags,text = next(i).split(':', 1)
26 assert(flags[0] == 'm')
29 flags,text = next(i).split(':', 1)
30 assert(flags[0] == 'e')
32 ctriple.append(indent)
34 flags,text = next(i).split(':', 1)
35 assert(len(flags) == 0)
39 elif 'b' in flags and 'f' not in flags:
41 rv.insert(0, (text,text,text, text, ""))
45 def _get_comment_format():
46 """ Returns a 4-element tuple representing the comment format for
48 return _parse_comments(vim.eval("&comments"))[0]
50 b, m, e, c, i = _get_comment_format()
54 snip.rv = subprocess.check_output(["git", "config", "user.name"]).strip()
55 except CalledProcessError:
58 def _git_user_email():
60 snip.rv = subprocess.check_output(["git", "config", "user.email"]).strip()
61 except CalledProcessError:
62 snip.rv = "jdoe@example.com"
67 `!p snip.rv = c`FIXME~~sb ${VISUAL}${0} (`!v strftime("%Y-%m-%d")`)
71 `!p snip.rv = c`TODO~~sb ${VISUAL}${0} (`!v strftime("%Y-%m-%d")`)
74 snippet GPL2 "GPL2 License" b
76 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
78 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
80 `!p snip.rv = i + m` This program is free software; you can redistribute it and/or modify
81 `!p snip.rv = i + m` it under the terms of the GNU General Public License as published by
82 `!p snip.rv = i + m` the Free Software Foundation; either version 2 of the License, or
83 `!p snip.rv = i + m` (at your option) any later version.
85 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
86 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
87 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 `!p snip.rv = i + m` GNU General Public License for more details.
90 `!p snip.rv = i + m` You should have received a copy of the GNU General Public License
91 `!p snip.rv = i + m` along with this program; if not, see <http://www.gnu.org/licenses/>.
96 snippet LGPL2 "LGPL2 License" b
98 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
100 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
102 `!p snip.rv = i + m` This library is free software; you can redistribute it and/or modify
103 `!p snip.rv = i + m` it under the terms of the GNU Lesser General Public License as published
104 `!p snip.rv = i + m` by the Free Software Foundation; either version 2.1 of the License, or
105 `!p snip.rv = i + m` (at your option) any later version.
107 `!p snip.rv = i + m` This library is distributed in the hope that it will be useful,
108 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
109 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110 `!p snip.rv = i + m` GNU Lesser General Public License for more details.
112 `!p snip.rv = i + m` You should have received a copy of the GNU Lesser General Public License
113 `!p snip.rv = i + m` along with this library; if not, see <http://www.gnu.org/licenses/>.
118 snippet GPL3 "GPL3 License" b
120 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description.}
122 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
124 `!p snip.rv = i + m` This program is free software: you can redistribute it and/or modify
125 `!p snip.rv = i + m` it under the terms of the GNU General Public License as published by
126 `!p snip.rv = i + m` the Free Software Foundation, either version 3 of the License, or
127 `!p snip.rv = i + m` (at your option) any later version.
129 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
130 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
131 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132 `!p snip.rv = i + m` GNU General Public License for more details.
134 `!p snip.rv = i + m` You should have received a copy of the GNU General Public License
135 `!p snip.rv = i + m` along with this program. If not, see <http://www.gnu.org/licenses/>.
140 snippet LGPL3 "LGPL3 License" b
142 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
144 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
146 `!p snip.rv = i + m` This library is free software; you can redistribute it and/or modify
147 `!p snip.rv = i + m` it under the terms of the GNU Lesser General Public License as published
148 `!p snip.rv = i + m` by the Free Software Foundation; either version 3 of the License, or
149 `!p snip.rv = i + m` (at your option) any later version.
151 `!p snip.rv = i + m` This library is distributed in the hope that it will be useful,
152 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
153 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
154 `!p snip.rv = i + m` GNU Lesser General Public License for more details.
156 `!p snip.rv = i + m` You should have received a copy of the GNU Lesser General Public License
157 `!p snip.rv = i + m` along with this library; if not, see <http://www.gnu.org/licenses/>.
162 snippet AGPL3 "AGPL3 License" b
164 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description.}
166 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
168 `!p snip.rv = i + m` This program is free software: you can redistribute it and/or modify
169 `!p snip.rv = i + m` it under the terms of the GNU Affero General Public License as
170 `!p snip.rv = i + m` published by the Free Software Foundation, either version 3 of the
171 `!p snip.rv = i + m` License, or (at your option) any later version.
173 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
174 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
175 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
176 `!p snip.rv = i + m` GNU Affero General Public License for more details.
178 `!p snip.rv = i + m` You should have received a copy of the GNU Affero General Public License
179 `!p snip.rv = i + m` along with this program. If not, see <http://www.gnu.org/licenses/>.
184 snippet GMGPL "GMGPL linking exception License" b
186 `!p snip.rv = i + m` As a special exception, if other files instantiate generics from
187 `!p snip.rv = i + m` this unit, or you link this unit with other files to produce an
188 `!p snip.rv = i + m` executable, this unit does not by itself cause the resulting
189 `!p snip.rv = i + m` executable to be covered by the GNU General Public License.
190 `!p snip.rv = i + m` This exception does not however invalidate any other reasons why the
191 `!p snip.rv = i + m` executable file might be covered by the GNU Public License.
196 snippet BSD2 "BSD2 License" b
198 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
200 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
201 `!p snip.rv = i + m` All rights reserved.
203 `!p snip.rv = i + m` Redistribution and use in source and binary forms, with or without
204 `!p snip.rv = i + m` modification, are permitted provided that the following conditions are met:
205 `!p snip.rv = i + m` 1. Redistributions of source code must retain the above copyright
206 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer.
207 `!p snip.rv = i + m` 2. Redistributions in binary form must reproduce the above copyright
208 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer in the
209 `!p snip.rv = i + m` documentation and/or other materials provided with the distribution.
211 `!p snip.rv = i + m` THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
212 `!p snip.rv = i + m` EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
213 `!p snip.rv = i + m` WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
214 `!p snip.rv = i + m` DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
215 `!p snip.rv = i + m` DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
216 `!p snip.rv = i + m` (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
217 `!p snip.rv = i + m` LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
218 `!p snip.rv = i + m` ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
219 `!p snip.rv = i + m` (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
220 `!p snip.rv = i + m` SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223 `!p snip.rv = i + m` The views and conclusions contained in the software and documentation
224 `!p snip.rv = i + m` are those of the authors and should not be interpreted as representing
225 `!p snip.rv = i + m` official policies, either expressedor implied, of $2.
230 snippet BSD3 "BSD3 License" b
232 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
234 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
235 `!p snip.rv = i + m` All rights reserved.
237 `!p snip.rv = i + m` Redistribution and use in source and binary forms, with or without
238 `!p snip.rv = i + m` modification, are permitted provided that the following conditions are met:
239 `!p snip.rv = i + m` 1. Redistributions of source code must retain the above copyright
240 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer.
241 `!p snip.rv = i + m` 2. Redistributions in binary form must reproduce the above copyright
242 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer in the
243 `!p snip.rv = i + m` documentation and/or other materials provided with the distribution.
244 `!p snip.rv = i + m` 3. Neither the name of the ${4:organization} nor the
245 `!p snip.rv = i + m` names of its contributors may be used to endorse or promote products
246 `!p snip.rv = i + m` derived from this software without specific prior written permission.
248 `!p snip.rv = i + m` THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
249 `!p snip.rv = i + m` EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
250 `!p snip.rv = i + m` WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
251 `!p snip.rv = i + m` DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
252 `!p snip.rv = i + m` DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
253 `!p snip.rv = i + m` (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
254 `!p snip.rv = i + m` LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
255 `!p snip.rv = i + m` ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256 `!p snip.rv = i + m` (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
257 `!p snip.rv = i + m` SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262 snippet BSD4 "BSD4 License" b
264 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
266 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
267 `!p snip.rv = i + m` All rights reserved.
269 `!p snip.rv = i + m` Redistribution and use in source and binary forms, with or without
270 `!p snip.rv = i + m` modification, are permitted provided that the following conditions are met:
271 `!p snip.rv = i + m` 1. Redistributions of source code must retain the above copyright
272 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer.
273 `!p snip.rv = i + m` 2. Redistributions in binary form must reproduce the above copyright
274 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer in the
275 `!p snip.rv = i + m` documentation and/or other materials provided with the distribution.
276 `!p snip.rv = i + m` 3. All advertising materials mentioning features or use of this software
277 `!p snip.rv = i + m` must display the following acknowledgement:
278 `!p snip.rv = i + m` This product includes software developed by the ${4:organization}.
279 `!p snip.rv = i + m` 4. Neither the name of the $4 nor the
280 `!p snip.rv = i + m` names of its contributors may be used to endorse or promote products
281 `!p snip.rv = i + m` derived from this software without specific prior written permission.
283 `!p snip.rv = i + m` THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
284 `!p snip.rv = i + m` EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
285 `!p snip.rv = i + m` WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
286 `!p snip.rv = i + m` DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
287 `!p snip.rv = i + m` DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
288 `!p snip.rv = i + m` (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
289 `!p snip.rv = i + m` LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
290 `!p snip.rv = i + m` ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291 `!p snip.rv = i + m` (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
292 `!p snip.rv = i + m` SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
297 snippet MIT "MIT License" b
299 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
301 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
303 `!p snip.rv = i + m` Permission is hereby granted, free of charge, to any person obtaining
304 `!p snip.rv = i + m` a copy of this software and associated documentation files (the "Software"),
305 `!p snip.rv = i + m` to deal in the Software without restriction, including without limitation
306 `!p snip.rv = i + m` the rights to use, copy, modify, merge, publish, distribute, sublicense,
307 `!p snip.rv = i + m` and/or sell copies of the Software, and to permit persons to whom the
308 `!p snip.rv = i + m` Software is furnished to do so, subject to the following conditions:
310 `!p snip.rv = i + m` The above copyright notice and this permission notice shall be included
311 `!p snip.rv = i + m` in all copies or substantial portions of the Software.
313 `!p snip.rv = i + m` THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
314 `!p snip.rv = i + m` EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
315 `!p snip.rv = i + m` OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
316 `!p snip.rv = i + m` IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
317 `!p snip.rv = i + m` DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
318 `!p snip.rv = i + m` TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
319 `!p snip.rv = i + m` OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
324 snippet APACHE "APACHE License" b
326 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
328 `!p snip.rv = i + m` Copyright `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
330 `!p snip.rv = i + m` Licensed under the Apache License, Version 2.0 (the "License");
331 `!p snip.rv = i + m` you may not use this file except in compliance with the License.
332 `!p snip.rv = i + m` You may obtain a copy of the License at
334 `!p snip.rv = i + m` http://www.apache.org/licenses/LICENSE-2.0
336 `!p snip.rv = i + m` Unless required by applicable law or agreed to in writing, software
337 `!p snip.rv = i + m` distributed under the License is distributed on an "AS IS" BASIS,
338 `!p snip.rv = i + m` WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
339 `!p snip.rv = i + m` See the License for the specific language governing permissions and
340 `!p snip.rv = i + m` limitations under the License.
345 snippet BEERWARE "BEERWARE License" b
347 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
349 `!p snip.rv = i + m` Copyright `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
351 `!p snip.rv = i + m` Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
352 `!p snip.rv = i + m` $2 wrote this file. As long as you retain this notice you
353 `!p snip.rv = i + m` can do whatever you want with this stuff. If we meet some day, and you think
354 `!p snip.rv = i + m` this stuff is worth it, you can buy me a beer or coffee in return
359 snippet WTFPL "WTFPL License" b
361 `!p snip.rv = i + m` DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
362 `!p snip.rv = i + m` Version 2, December 2004
364 `!p snip.rv = i + m` Copyright `!v strftime("%Y")` ${1:`!p _git_user_name()`} <${2:`!p _git_user_email()`}>
366 `!p snip.rv = i + m` Everyone is permitted to copy and distribute verbatim or modified
367 `!p snip.rv = i + m` copies of this license document, and changing it is allowed as long
368 `!p snip.rv = i + m` as the name is changed.
370 `!p snip.rv = i + m` DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
371 `!p snip.rv = i + m` TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
373 `!p snip.rv = i + m` 0. You just DO WHAT THE FUCK YOU WANT TO.
379 snippet MPL2 "MPL2 License" b
381 `!p snip.rv = i + m` This Source Code Form is subject to the terms of the Mozilla Public
382 `!p snip.rv = i + m` License, v. 2.0. If a copy of the MPL was not distributed with this
383 `!p snip.rv = i + m` file, You can obtain one at http://mozilla.org/MPL/2.0/.
388 snippet AGPL "AGPL License" b
390 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
392 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
394 `!p snip.rv = i + m` This program is free software: you can redistribute it and/or modify
395 `!p snip.rv = i + m` it under the terms of the GNU Affero General Public License as
396 `!p snip.rv = i + m` published by the Free Software Foundation, either version 3 of the
397 `!p snip.rv = i + m` License, or (at your option) any later version.
399 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
400 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
401 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
402 `!p snip.rv = i + m` GNU Affero General Public License for more details.
404 `!p snip.rv = i + m` You should have received a copy of the GNU Affero General Public License
405 `!p snip.rv = i + m` along with this program. If not, see <http://www.gnu.org/licenses/>.