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, ""))
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)
35 elif 'b' in flags and 'f' not in flags:
37 rv.insert(0, (text,text,text, ""))
41 def _get_comment_format():
42 """ Returns a 4-element tuple representing the comment format for
44 return _parse_comments(vim.eval("&comments"))[0]
46 b, m, e, i = _get_comment_format()
49 snip.rv = subprocess.check_output(["git", "config", "user.name"]).strip()
50 except CalledProcessError:
53 def _git_user_email():
55 snip.rv = subprocess.check_output(["git", "config", "user.email"]).strip()
56 except CalledProcessError:
57 snip.rv = "jdoe@example.com"
61 snippet GPL2 "GPL2 License" b
63 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
65 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
67 `!p snip.rv = i + m` This program is free software; you can redistribute it and/or modify
68 `!p snip.rv = i + m` it under the terms of the GNU General Public License as published by
69 `!p snip.rv = i + m` the Free Software Foundation; either version 2 of the License, or
70 `!p snip.rv = i + m` (at your option) any later version.
72 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
73 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
74 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
75 `!p snip.rv = i + m` GNU General Public License for more details.
77 `!p snip.rv = i + m` You should have received a copy of the GNU General Public License
78 `!p snip.rv = i + m` along with this program; if not, see <http://www.gnu.org/licenses/>.
83 snippet LGPL2 "LGPL2 License" b
85 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
87 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
89 `!p snip.rv = i + m` This library is free software; you can redistribute it and/or modify
90 `!p snip.rv = i + m` it under the terms of the GNU Lesser General Public License as published
91 `!p snip.rv = i + m` by the Free Software Foundation; either version 2.1 of the License, or
92 `!p snip.rv = i + m` (at your option) any later version.
94 `!p snip.rv = i + m` This library is distributed in the hope that it will be useful,
95 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
96 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97 `!p snip.rv = i + m` GNU Lesser General Public License for more details.
99 `!p snip.rv = i + m` You should have received a copy of the GNU Lesser General Public License
100 `!p snip.rv = i + m` along with this library; if not, see <http://www.gnu.org/licenses/>.
105 snippet GPL3 "GPL3 License" b
107 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description.}
109 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
111 `!p snip.rv = i + m` This program is free software: you can redistribute it and/or modify
112 `!p snip.rv = i + m` it under the terms of the GNU General Public License as published by
113 `!p snip.rv = i + m` the Free Software Foundation, either version 3 of the License, or
114 `!p snip.rv = i + m` (at your option) any later version.
116 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
117 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
118 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
119 `!p snip.rv = i + m` GNU General Public License for more details.
121 `!p snip.rv = i + m` You should have received a copy of the GNU General Public License
122 `!p snip.rv = i + m` along with this program. If not, see <http://www.gnu.org/licenses/>.
127 snippet LGPL3 "LGPL3 License" b
129 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
131 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
133 `!p snip.rv = i + m` This library is free software; you can redistribute it and/or modify
134 `!p snip.rv = i + m` it under the terms of the GNU Lesser General Public License as published
135 `!p snip.rv = i + m` by the Free Software Foundation; either version 3 of the License, or
136 `!p snip.rv = i + m` (at your option) any later version.
138 `!p snip.rv = i + m` This library is distributed in the hope that it will be useful,
139 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
140 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
141 `!p snip.rv = i + m` GNU Lesser General Public License for more details.
143 `!p snip.rv = i + m` You should have received a copy of the GNU Lesser General Public License
144 `!p snip.rv = i + m` along with this library; if not, see <http://www.gnu.org/licenses/>.
149 snippet AGPL3 "AGPL3 License" b
151 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description.}
153 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
155 `!p snip.rv = i + m` This program is free software: you can redistribute it and/or modify
156 `!p snip.rv = i + m` it under the terms of the GNU Affero General Public License as
157 `!p snip.rv = i + m` published by the Free Software Foundation, either version 3 of the
158 `!p snip.rv = i + m` License, or (at your option) any later version.
160 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
161 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
162 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
163 `!p snip.rv = i + m` GNU Affero General Public License for more details.
165 `!p snip.rv = i + m` You should have received a copy of the GNU Affero General Public License
166 `!p snip.rv = i + m` along with this program. If not, see <http://www.gnu.org/licenses/>.
171 snippet GMGPL linking exception "GMGPL linking exception License" b
173 `!p snip.rv = i + m` As a special exception, if other files instantiate generics from
174 `!p snip.rv = i + m` this unit, or you link this unit with other files to produce an
175 `!p snip.rv = i + m` executable, this unit does not by itself cause the resulting
176 `!p snip.rv = i + m` executable to be covered by the GNU General Public License.
177 `!p snip.rv = i + m` This exception does not however invalidate any other reasons why the
178 `!p snip.rv = i + m` executable file might be covered by the GNU Public License.
183 snippet BSD2 "BSD2 License" b
185 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
187 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
188 `!p snip.rv = i + m` All rights reserved.
190 `!p snip.rv = i + m` Redistribution and use in source and binary forms, with or without
191 `!p snip.rv = i + m` modification, are permitted provided that the following conditions are met:
192 `!p snip.rv = i + m` 1. Redistributions of source code must retain the above copyright
193 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer.
194 `!p snip.rv = i + m` 2. Redistributions in binary form must reproduce the above copyright
195 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer in the
196 `!p snip.rv = i + m` documentation and/or other materials provided with the distribution.
198 `!p snip.rv = i + m` THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
199 `!p snip.rv = i + m` EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
200 `!p snip.rv = i + m` WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
201 `!p snip.rv = i + m` DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
202 `!p snip.rv = i + m` DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
203 `!p snip.rv = i + m` (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
204 `!p snip.rv = i + m` LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
205 `!p snip.rv = i + m` ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
206 `!p snip.rv = i + m` (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
207 `!p snip.rv = i + m` SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
210 `!p snip.rv = i + m` The views and conclusions contained in the software and documentation
211 `!p snip.rv = i + m` are those of the authors and should not be interpreted as representing
212 `!p snip.rv = i + m` official policies, either expressedor implied, of $2.
217 snippet BSD3 "BSD3 License" b
219 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
221 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
222 `!p snip.rv = i + m` All rights reserved.
224 `!p snip.rv = i + m` Redistribution and use in source and binary forms, with or without
225 `!p snip.rv = i + m` modification, are permitted provided that the following conditions are met:
226 `!p snip.rv = i + m` 1. Redistributions of source code must retain the above copyright
227 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer.
228 `!p snip.rv = i + m` 2. Redistributions in binary form must reproduce the above copyright
229 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer in the
230 `!p snip.rv = i + m` documentation and/or other materials provided with the distribution.
231 `!p snip.rv = i + m` 3. Neither the name of the ${4:organization} nor the
232 `!p snip.rv = i + m` names of its contributors may be used to endorse or promote products
233 `!p snip.rv = i + m` derived from this software without specific prior written permission.
235 `!p snip.rv = i + m` THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
236 `!p snip.rv = i + m` EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
237 `!p snip.rv = i + m` WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
238 `!p snip.rv = i + m` DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
239 `!p snip.rv = i + m` DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
240 `!p snip.rv = i + m` (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
241 `!p snip.rv = i + m` LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
242 `!p snip.rv = i + m` ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
243 `!p snip.rv = i + m` (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
244 `!p snip.rv = i + m` SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
249 snippet BSD4 "BSD4 License" b
251 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
253 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
254 `!p snip.rv = i + m` All rights reserved.
256 `!p snip.rv = i + m` Redistribution and use in source and binary forms, with or without
257 `!p snip.rv = i + m` modification, are permitted provided that the following conditions are met:
258 `!p snip.rv = i + m` 1. Redistributions of source code must retain the above copyright
259 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer.
260 `!p snip.rv = i + m` 2. Redistributions in binary form must reproduce the above copyright
261 `!p snip.rv = i + m` notice, this list of conditions and the following disclaimer in the
262 `!p snip.rv = i + m` documentation and/or other materials provided with the distribution.
263 `!p snip.rv = i + m` 3. All advertising materials mentioning features or use of this software
264 `!p snip.rv = i + m` must display the following acknowledgement:
265 `!p snip.rv = i + m` This product includes software developed by the ${4:organization}.
266 `!p snip.rv = i + m` 4. Neither the name of the $4 nor the
267 `!p snip.rv = i + m` names of its contributors may be used to endorse or promote products
268 `!p snip.rv = i + m` derived from this software without specific prior written permission.
270 `!p snip.rv = i + m` THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
271 `!p snip.rv = i + m` EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
272 `!p snip.rv = i + m` WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
273 `!p snip.rv = i + m` DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
274 `!p snip.rv = i + m` DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
275 `!p snip.rv = i + m` (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
276 `!p snip.rv = i + m` LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
277 `!p snip.rv = i + m` ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
278 `!p snip.rv = i + m` (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
279 `!p snip.rv = i + m` SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284 snippet MIT "MIT License" b
286 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
288 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
290 `!p snip.rv = i + m` Permission is hereby granted, free of charge, to any person obtaining
291 `!p snip.rv = i + m` a copy of this software and associated documentation files (the "Software"),
292 `!p snip.rv = i + m` to deal in the Software without restriction, including without limitation
293 `!p snip.rv = i + m` the rights to use, copy, modify, merge, publish, distribute, sublicense,
294 `!p snip.rv = i + m` and/or sell copies of the Software, and to permit persons to whom the
295 `!p snip.rv = i + m` Software is furnished to do so, subject to the following conditions:
297 `!p snip.rv = i + m` The above copyright notice and this permission notice shall be included
298 `!p snip.rv = i + m` in all copies or substantial portions of the Software.
300 `!p snip.rv = i + m` THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
301 `!p snip.rv = i + m` EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
302 `!p snip.rv = i + m` OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
303 `!p snip.rv = i + m` IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
304 `!p snip.rv = i + m` DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
305 `!p snip.rv = i + m` TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
306 `!p snip.rv = i + m` OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
311 snippet APACHE "APACHE License" b
313 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
315 `!p snip.rv = i + m` Copyright `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
317 `!p snip.rv = i + m` Licensed under the Apache License, Version 2.0 (the "License");
318 `!p snip.rv = i + m` you may not use this file except in compliance with the License.
319 `!p snip.rv = i + m` You may obtain a copy of the License at
321 `!p snip.rv = i + m` http://www.apache.org/licenses/LICENSE-2.0
323 `!p snip.rv = i + m` Unless required by applicable law or agreed to in writing, software
324 `!p snip.rv = i + m` distributed under the License is distributed on an "AS IS" BASIS,
325 `!p snip.rv = i + m` WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
326 `!p snip.rv = i + m` See the License for the specific language governing permissions and
327 `!p snip.rv = i + m` limitations under the License.
332 snippet BEERWARE "BEERWARE License" b
334 `!p snip.rv = i + m` ${1:one line to give the program's name and a brief description}
336 `!p snip.rv = i + m` Copyright `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
338 `!p snip.rv = i + m` Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
339 `!p snip.rv = i + m` $2 wrote this file. As long as you retain this notice you
340 `!p snip.rv = i + m` can do whatever you want with this stuff. If we meet some day, and you think
341 `!p snip.rv = i + m` this stuff is worth it, you can buy me a beer or coffee in return
346 snippet WTFPL "WTFPL License" b
348 `!p snip.rv = i + m` DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
349 `!p snip.rv = i + m` Version 2, December 2004
351 `!p snip.rv = i + m` Copyright `!v strftime("%Y")` ${1:`!p _git_user_name()`} <${2:`!p _git_user_email()`}>
353 `!p snip.rv = i + m` Everyone is permitted to copy and distribute verbatim or modified
354 `!p snip.rv = i + m` copies of this license document, and changing it is allowed as long
355 `!p snip.rv = i + m` as the name is changed.
357 `!p snip.rv = i + m` DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
358 `!p snip.rv = i + m` TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
360 `!p snip.rv = i + m` 0. You just DO WHAT THE FUCK YOU WANT TO.
366 snippet MPL2 "MPL2 License" b
368 `!p snip.rv = i + m` This Source Code Form is subject to the terms of the Mozilla Public
369 `!p snip.rv = i + m` License, v. 2.0. If a copy of the MPL was not distributed with this
370 `!p snip.rv = i + m` file, You can obtain one at http://mozilla.org/MPL/2.0/.
375 snippet AGPL "AGPL License" b
377 `!p snip.rv = i + m` ${1:One line to give the program's name and a brief description.}
379 `!p snip.rv = i + m` Copyright `!v &enc[:2] == "utf" ? "©" : "(c)"` `!v strftime("%Y")` ${2:`!p _git_user_name()`} <${3:`!p _git_user_email()`}>
381 `!p snip.rv = i + m` This program is free software: you can redistribute it and/or modify
382 `!p snip.rv = i + m` it under the terms of the GNU Affero General Public License as
383 `!p snip.rv = i + m` published by the Free Software Foundation, either version 3 of the
384 `!p snip.rv = i + m` License, or (at your option) any later version.
386 `!p snip.rv = i + m` This program is distributed in the hope that it will be useful,
387 `!p snip.rv = i + m` but WITHOUT ANY WARRANTY; without even the implied warranty of
388 `!p snip.rv = i + m` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
389 `!p snip.rv = i + m` GNU Affero General Public License for more details.
391 `!p snip.rv = i + m` You should have received a copy of the GNU Affero General Public License
392 `!p snip.rv = i + m` along with this program. If not, see <http://www.gnu.org/licenses/>.