Updated runtime files.

This commit is contained in:
Bram Moolenaar
2015-06-09 19:44:55 +02:00
parent d0d0fe09cf
commit f2571c61d5
22 changed files with 505 additions and 176 deletions

View File

@ -2,7 +2,7 @@
" Filename: spec.vim
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
" Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014)
" Last Change: Fri Feb 20 16:01 MSK 2014 Igor Gnatenko
" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko
if exists("b:did_ftplugin")
finish
@ -22,11 +22,36 @@ if !hasmapto("call <SID>SpecChangelog(\"\")<CR>")
noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR>
endif
if !exists("*s:GetRelVer")
function! s:GetRelVer()
if has('python')
python << PYEND
import sys, datetime, shutil, tempfile
import vim
try:
import rpm
except ImportError:
pass
else:
specfile = vim.current.buffer.name
if specfile:
spec = rpm.spec(specfile)
headers = spec.packages[0].header
version = headers['Version']
release = ".".join(headers['Release'].split(".")[:-1])
vim.command("let ver = " + version)
vim.command("let rel = " + release)
PYEND
endif
endfunction
endif
if !exists("*s:SpecChangelog")
function s:SpecChangelog(format)
if strlen(a:format) == 0
if !exists("g:spec_chglog_format")
let email = input("Email address: ")
let email = input("Name <email address>: ")
let g:spec_chglog_format = "%a %b %d %Y " . l:email
echo "\r"
endif
@ -71,6 +96,9 @@ if !exists("*s:SpecChangelog")
else
let include_release_info = 0
endif
call s:GetRelVer()
if (chgline == -1)
let option = confirm("Can't find %changelog. Create one? ","&End of file\n&Here\n&Cancel",3)
if (option == 1)
@ -85,7 +113,7 @@ if !exists("*s:SpecChangelog")
endif
endif
if (chgline != -1)
let parsed_format = "* ".strftime(format)
let parsed_format = "* ".strftime(format)." - ".ver."-".rel
let release_info = "+ ".name."-".ver."-".rel
let wrong_format = 0
let wrong_release = 0