Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 604634 Details for
Bug 848386
RFE: update spec.vim ftplugin
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Latest vim script with minor improvements
spec.vim (text/plain), 5.94 KB, created by
Jaroslav Škarvada
on 2012-08-15 15:56:52 UTC
(
hide
)
Description:
Latest vim script with minor improvements
Filename:
MIME Type:
Creator:
Jaroslav Škarvada
Created:
2012-08-15 15:56:52 UTC
Size:
5.94 KB
patch
obsolete
>" Vim filetype plugin >" Language: spec file >" Maintainer: Guillaume Rousse <guillomovitch@zarb.org> >" URL: http://www.zarb.org/~guillomovitch/linux/spec.vim >" Version: $Id: spec.vim 181 2005-07-21 18:37:45Z guillaume $ >" Minor iprovements by Jaroslav Å karvada <jskarvad@redhat.com> 2012-08-15 > >if exists("b:did_ftplugin") > finish >endif >let b:did_ftplugin = 1 > >" Add mappings, unless user doesn't want >if !exists("no_plugin_maps") && !exists("no_spec_maps") > if !hasmapto("<Plug>AddChangelogEntry") > map <buffer> <LocalLeader>ch <Plug>AddChangelogEntry > endif > if !hasmapto("<Plug>AddChangelogItem") > map <buffer> <LocalLeader>CH <Plug>AddChangelogItem > endif > noremap <buffer> <unique> <script> <Plug>AddChangelogEntry :call <SID>AddChangelogEntry()<CR> > noremap <buffer> <unique> <script> <Plug>AddChangelogItem :call <SID>AddChangelogItem()<CR> >endif > >" compilation option >setlocal makeprg=rpm\ -ba\ % >setlocal errorformat=error:\ line\ %l:\ %m > >" navigation through sections >let b:match_ignorecase = 0 >let b:match_words = > \ '^Name:^%description:^%clean:^^%setup:^%build:^%install:^%files:' . > \ '^%package:^%pre:^%post:^%changelog:^%check' > >if !exists("*s:AddChangelogEntry") > " Adds a changelog entry > function s:AddChangelogEntry() > " look for changelog section > let l:line = <SID>LocateChangelogSection() > " insert changelog header just after > call <SID>InsertChangelogHeader(l:line) > " insert changelog item just after > call <SID>InsertChangelogItem(l:line + 1) > endfunction >endif > >if !exists("*s:AddChangelogItem") > " Adds a changelog item > function s:AddChangelogItem() > " look for changelog section > let l:line = <SID>LocateChangelogSection() > " look for first header > let l:entry = search('^\*', 'W') > if l:entry == 0 > call <SID>InsertChangelogHeader(l:line) > let l:entry = l:line + 1 > endif > " look for either first or last item > if exists("g:spec_chglog_prepend") > let l:item = l:entry > else > let l:item = search('^$', 'W') > if l:item == 0 > let l:item = line('$') > else > let l:item = l:item - 1 > endif > endif > call <SID>InsertChangelogItem(l:item) > endfunction >endif > >if !exists("*s:LocateChangelogSection") > " Locate changelog section, creating it if needed > function s:LocateChangelogSection() > let l:line = search('^%changelog', 'w') > if l:line == 0 > let l:line = line('$') > if getline(l:line) !~ '^$' > call append(l:line, '') > let l:line = l:line + 1 > endif > call append(l:line, '%changelog') > let l:line = l:line + 1 > call cursor(l:line, 1) > endif > return l:line > endfunction >endif > >if !exists("*s:InsertChangelogHeader") > " Insert a changelog header at the given line > function s:InsertChangelogHeader(line) > " ensure english locale > language time C > " read values from configuration > let s:date = exists("g:spec_chglog_date") ? g:spec_chglog_date : "%a %b %d %Y" > let s:packager = exists("g:spec_chglog_packager") ? g:spec_chglog_packager : <SID>GetExternalMacroValue("packager") > let s:revision = exists("g:spec_chglog_revision") ? g:spec_chglog_revision : 1 > " compute header > let l:header = "*" > if strlen(s:date) > let l:header = l:header . ' ' . strftime(s:date) > endif > if strlen(s:packager) > let l:header = l:header . ' ' . s:packager > endif > if s:revision > let l:epoch = <SID>GetTagValue("Epoch") > let l:version = <SID>GetTagValue("Version") > let l:release = <SID>GetTagValue("Release") > let l:release = substitute(l:release, "%{?dist}", "", "") > if strlen(l:epoch) > let l:header = l:header . ' - ' . l:epoch . ':' . l:version . '-' . l:release > else > let l:header = l:header . ' - ' . l:version . '-' . l:release > endif > endif > " insert blank line if needed > if getline(a:line + 1) !~ '^$' > call append(a:line, "") > endif > " insert changelog header > call append(a:line, l:header) > " position cursor here > call cursor(a:line + 1, 1) > endfunction >endif > >if !exists("*s:InsertChangelogItem") > " Insert a changelog entry at the given line > function s:InsertChangelogItem(line) > " insert changelog entry > call append(a:line, "- ") > " position cursor here > call cursor(a:line + 1, 1) > " enter insert mode > startinsert! > endfunction >endif > >if !exists("*s:GetTagValue") > " Return value of a rpm tag > function s:GetTagValue(tag) > let l:pattern = '^' . a:tag . ':\s*' > let l:line = search(l:pattern, 'w') > if l:line != 0 > let l:string = getline(l:line) > let l:value = substitute(l:string, l:pattern, "", "") > > " resolve macros > while (l:value =~ '%{\??\?\w\{3,}}\?') > let l:macro = matchstr(l:value, '%{\??\?\w\{3,}}\?\(\s\+.\+\)\?') > if l:macro =~ '%\w\{3,}\s\+.\+' > let l:macro_name = substitute(l:macro, '%\(\w\{3,}\s\+\)', '\1', "") > let l:macro_value = <SID>GetExternalMacroValue(l:macro_name) > let l:value = substitute(l:value, '%' . l:macro_name, l:macro_value, "") > else > let l:macro_name = substitute(l:macro, '%{\??\?\(\w\{3,}\)}\?', '\1', "") > let l:macro_value = <SID>GetMacroValue(l:macro_name) > let l:value = substitute(l:value, '%{\??\?' . l:macro_name . '}\?', l:macro_value, "") > endif > endwhile > else > let l:value = '' > endif > return l:value > endfunction >endif > >if !exists("*s:GetMacroValue") > " Return value of a rpm macro > function s:GetMacroValue(macro) > let l:pattern = '^\(\(%define\)\|\(%global\)\)\s*' . a:macro . '\s*' > let l:line = search(l:pattern, 'w') > if l:line != 0 > let l:string = getline(l:line) > let l:value = substitute(l:string, l:pattern, "", "") > else > " try to read externaly defined values > let l:value = <SID>GetExternalMacroValue(a:macro) > endif > return l:value > endfunction >endif > >if !exists("*s:GetExternalMacroValue") > " Return value of an external rpm macro > function s:GetExternalMacroValue(macro) > if a:macro == 'dist' > " hardcode dist macro > let l:value = "" > else > let l:value = system("rpm --eval '%" . a:macro . "'") > let l:value = strpart(l:value, 0, strlen(l:value) - 1) > endif > " return empty string for unknown macros > if l:value == "%" . a:macro > let l:value = "" > endif > return l:value > endfunction >endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 848386
: 604634