From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 97055138334 for ; Tue, 14 Aug 2018 13:55:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8D8C9E08C0; Tue, 14 Aug 2018 13:55:34 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3C640E08BF for ; Tue, 14 Aug 2018 13:55:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8C9A6335C7D for ; Tue, 14 Aug 2018 13:55:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5798C3AA for ; Tue, 14 Aug 2018 13:55:30 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1534254926.1d9835779a3da3e1ec8e837b256a98aceef913af.mgorny@gentoo> Subject: [gentoo-commits] proj/gentoo-syntax:master commit in: plugin/ X-VCS-Repository: proj/gentoo-syntax X-VCS-Files: plugin/newglep.vim X-VCS-Directories: plugin/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 1d9835779a3da3e1ec8e837b256a98aceef913af X-VCS-Branch: master Date: Tue, 14 Aug 2018 13:55:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c43032e0-4714-4a28-b8e0-1433b2c30ca7 X-Archives-Hash: b8238cc6550b7389c7cb5d2250560402 commit: 1d9835779a3da3e1ec8e837b256a98aceef913af Author: Michał Górny gentoo org> AuthorDate: Fri Sep 15 13:41:17 2017 +0000 Commit: Michał Górny gentoo org> CommitDate: Tue Aug 14 13:55:26 2018 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=1d983577 plugin: newglep to fill GLEP skeleton in Closes: https://github.com/gentoo/gentoo-syntax/pull/14 plugin/newglep.vim | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/plugin/newglep.vim b/plugin/newglep.vim new file mode 100644 index 0000000..c8cf03a --- /dev/null +++ b/plugin/newglep.vim @@ -0,0 +1,104 @@ +" Vim plugin +" Purpose: New GLEP skeleton +" Author: Michał Górny +" Copyright: Copyright (c) 2017 Michał Górny +" Licence: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 || exists("g:loaded_newglep") + finish +endif + +let g:loaded_newglep=1 + +runtime! plugin/gentoo-common.vim + +fun! MakeNewGLEP() + let l:pastebackup = &paste + set nopaste + + " {{{ variables + let l:filename = expand("%:t") + let l:basename = expand("%:t:r") + let l:number = str2nr(substitute(l:basename, "^glep-", "", "")) + let l:date = strftime("%Y-%m-%d") + " }}} + + " {{{ header preamble + put ='---' + put ='GLEP: ' . l:number + put ='Title: ' + put ='Author: ' . GentooGetUser() + put ='Type: Standards Track' + put ='Status: Draft' + put ='Version: 1' + put ='Created: ' . l:date + put ='Last-Modified: ' . l:date + put ='Post-History: ' + put ='Content-Type: text/x-rst' + put ='Requires: ' + put ='Replaces: ' + put ='---' + " }}} + + " {{{ warn if .txt suffix is used + if l:filename =~# ".txt\$" + put ='' + put ='.. Warning: .txt suffix is obsolete, use \"' . l:basename . '.rst\" instead' + endif + " }}} + + " {{{ skeleton + let l:sections = ['Abstract', 'Motivation', 'Specification', 'Rationale', + \ 'Backwards Compatibility', 'Reference Implementation', 'References', + \ 'Copyright'] + for l:section in l:sections + let l:sectlen = len(l:section) + put ='' + put =l:section + put =repeat('=', l:sectlen) + if l:section != 'Copyright' + put ='' + put ='' + put ='' + endif + endfor + " copyright + put ='This work is licensed under the Creative Commons Attribution-ShareAlike 3.0' + put ='Unported License. To view a copy of this license, visit' + put ='http://creativecommons.org/licenses/by-sa/3.0/.' + " }}} + + " {{{ go to the first thing to edit + 0 + del + /^Title:/ + normal $ + nohls + " }}} + + if pastebackup == 0 + set nopaste + endif +endfun + +com! -nargs=0 NewGLEP call MakeNewGLEP() | set filetype=glep + +if !exists("g:glep_create_on_empty") + " Enable autogeneration of GLEPs by default + let g:glep_create_on_empty = 1 +endif + +" check to see if v:progname is vimdiff to disable new GLEP creation +if v:progname =~ "vimdiff" + let g:glep_create_on_empty = 0 +endif + +augroup NewGLEP + au! + autocmd BufNewFile glep-[0-9][0-9][0-9][0-9].{txt,rst} + \ if g:glep_create_on_empty | + \ call MakeNewGLEP() | set filetype=glep | + \ endif +augroup END + +" vim: set et foldmethod=marker : "