diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-06 17:57:30 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-06 17:57:30 +0200 |
commit | 85eee130f44a2201d88ca2aeff0af3b11dd75fa9 (patch) | |
tree | 1748e216e4f90786b1a0789a054568976da40c42 /runtime/ftplugin/debchangelog.vim | |
parent | 7ce551f317a0bb92f8c0521e96325301e2d220ca (diff) | |
download | vim-git-85eee130f44a2201d88ca2aeff0af3b11dd75fa9.tar.gz |
Update runtime files.
Diffstat (limited to 'runtime/ftplugin/debchangelog.vim')
-rw-r--r-- | runtime/ftplugin/debchangelog.vim | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index 32f683109..a78f7811f 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -3,20 +3,20 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Michael Piefel <piefel@informatik.hu-berlin.de> " Stefano Zacchiroli <zack@debian.org> -" Last Change: 2018-01-06 +" Last Change: 2018-01-28 " License: Vim License " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim " Bug completion requires apt-listbugs installed for Debian packages or " python-launchpadlib installed for Ubuntu packages -if exists("b:did_ftplugin") +if exists('b:did_ftplugin') finish endif let b:did_ftplugin=1 " {{{1 Local settings (do on every load) -if exists("g:debchangelog_fold_enable") +if exists('g:debchangelog_fold_enable') setlocal foldmethod=expr setlocal foldexpr=DebGetChangelogFold(v:lnum) setlocal foldtext=DebChangelogFoldText() @@ -28,10 +28,10 @@ setlocal tw=78 setlocal comments=f:* " Clean unloading -let b:undo_ftplugin = "setlocal tw< comments< foldmethod< foldexpr< foldtext<" +let b:undo_ftplugin = 'setlocal tw< comments< foldmethod< foldexpr< foldtext<' " }}}1 -if exists("g:did_changelog_ftplugin") +if exists('g:did_changelog_ftplugin') finish endif @@ -44,41 +44,41 @@ let g:did_changelog_ftplugin = 1 " Returns full name, either from $DEBFULLNAME or debianfullname. " TODO Is there a way to determine name from anywhere else? function <SID>FullName() - if exists("$DEBFULLNAME") + if exists('$DEBFULLNAME') return $DEBFULLNAME - elseif exists("g:debianfullname") + elseif exists('g:debianfullname') return g:debianfullname else - return "Your Name" + return 'Your Name' endif endfunction " Returns email address, from $DEBEMAIL, $EMAIL or debianemail. function <SID>Email() - if exists("$DEBEMAIL") + if exists('$DEBEMAIL') return $DEBEMAIL - elseif exists("$EMAIL") + elseif exists('$EMAIL') return $EMAIL - elseif exists("g:debianemail") + elseif exists('g:debianemail') return g:debianemail else - return "your@email.address" + return 'your@email.address' endif endfunction " Returns date in RFC822 format. function <SID>Date() let savelang = v:lc_time - execute "language time C" - let dateandtime = strftime("%a, %d %b %Y %X %z") - execute "language time " . savelang + execute 'language time C' + let dateandtime = strftime('%a, %d %b %Y %X %z') + execute 'language time ' . savelang return dateandtime endfunction function <SID>WarnIfNotUnfinalised() - if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1 + if match(getline('.'), ' -- [[:alpha:]][[:alnum:].]')!=-1 echohl WarningMsg - echo "The entry has not been unfinalised before editing." + echo 'The entry has not been unfinalised before editing.' echohl None return 1 endif @@ -86,10 +86,10 @@ function <SID>WarnIfNotUnfinalised() endfunction function <SID>Finalised() - let savelinenum = line(".") - normal 1G - call search("^ -- ") - if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1 + let savelinenum = line('.') + 1 + call search('^ -- ') + if match(getline('.'), ' -- [[:alpha:]][[:alnum:].]')!=-1 let returnvalue = 1 else let returnvalue = 0 @@ -109,54 +109,54 @@ function NewVersion() amenu disable Changelog.Unfinalise amenu enable Changelog.Finalise call append(0, substitute(getline(1), '-\([[:digit:]]\+\))', '-$$\1)', '')) - call append(1, "") - call append(2, "") - call append(3, " -- ") - call append(4, "") - call Urgency("low") - normal 1G0 - call search(")") - normal h - normal + call append(1, '') + call append(2, '') + call append(3, ' -- ') + call append(4, '') + call Urgency('low') + normal! 1G0 + call search(')') + normal! h + normal! call setline(1, substitute(getline(1), '-\$\$', '-', '')) - if exists("g:debchangelog_fold_enable") + if exists('g:debchangelog_fold_enable') foldopen endif call AddEntry() endfunction function AddEntry() - normal 1G - call search("^ -- ") - normal kk - call append(".", " * ") - normal jjj + 1 + call search('^ -- ') + .-2 + call append('.', ' * ') + .+3 let warn=<SID>WarnIfNotUnfinalised() - normal kk + .-2 if warn echohl MoreMsg - call input("Hit ENTER") + call input('Hit ENTER') echohl None endif startinsert! endfunction function CloseBug() - normal 1G - call search("^ -- ") + 1 + call search('^ -- ') let warn=<SID>WarnIfNotUnfinalised() - normal kk - call append(".", " * (closes: #" . input("Bug number to close: ") . ")") - normal j^ll + .-2 + call append('.', ' * (closes: #' . input('Bug number to close: ') . ')') + normal! j^ll startinsert endfunction function Distribution(dist) - call setline(1, substitute(getline(1), ') *\%(UNRELEASED\|\l\+\);', ") " . a:dist . ";", "")) + call setline(1, substitute(getline(1), ') *\%(UNRELEASED\|\l\+\);', ') ' . a:dist . ';', '')) endfunction function Urgency(urg) - call setline(1, substitute(getline(1), "urgency=.*$", "urgency=" . a:urg, "")) + call setline(1, substitute(getline(1), 'urgency=.*$', 'urgency=' . a:urg, '')) endfunction function <SID>UnfinaliseMenu() @@ -172,9 +172,9 @@ endfunction function Unfinalise() call <SID>UnfinaliseMenu() - normal 1G - call search("^ -- ") - call setline(".", " -- ") + 1 + call search('^ -- ') + call setline('.', ' -- ') endfunction function <SID>FinaliseMenu() @@ -190,9 +190,9 @@ endfunction function Finalise() call <SID>FinaliseMenu() - normal 1G - call search("^ -- ") - call setline(".", " -- " . <SID>FullName() . " <" . <SID>Email() . "> " . <SID>Date()) + 1 + call search('^ -- ') + call setline('.', ' -- ' . <SID>FullName() . ' <' . <SID>Email() . '> ' . <SID>Date()) endfunction @@ -239,7 +239,7 @@ function! s:getAuthor(zonestart, zoneend) let linepos = a:zoneend while linepos >= a:zonestart let line = getline(linepos) - if line =~ '^ --' + if line =~# '^ --' return substitute(line, '^ --\s*\([^<]\+\)\s*.*', '\1', '') endif let linepos -= 1 @@ -254,7 +254,7 @@ function! DebGetPkgSrcName(lineno) let pkgname = '' while lineidx > 0 let curline = getline(lineidx) - if curline =~ '^\S' + if curline =~# '^\S' let pkgname = matchlist(curline, '^\(\S\+\).*$')[1] break endif @@ -264,7 +264,7 @@ function! DebGetPkgSrcName(lineno) endfunction function! DebChangelogFoldText() - if v:folddashes == '-' " changelog entry fold + if v:folddashes ==# '-' " changelog entry fold return foldtext() . ' -- ' . s:getAuthor(v:foldstart, v:foldend) . ' ' endif return foldtext() @@ -272,19 +272,19 @@ endfunction function! DebGetChangelogFold(lnum) let line = getline(a:lnum) - if line =~ '^\w\+' + if line =~# '^\w\+' return '>1' " beginning of a changelog entry endif - if line =~ '^\s\+\[.*\]' + if line =~# '^\s\+\[.*\]' return '>2' " beginning of an author-specific chunk endif - if line =~ '^ --' + if line =~# '^ --' return '1' endif return '=' endfunction -if exists("g:debchangelog_fold_enable") +if exists('g:debchangelog_fold_enable') silent! foldopen! " unfold the entry the cursor is on (usually the first one) endif @@ -305,13 +305,13 @@ fun! DebCompleteBugs(findstart, base) let try_colidx = col('.') - 1 let colidx = -1 " default to no-completion-possible - while try_colidx > 0 && line[try_colidx - 1] =~ '\s\|\d\|#\|,\|:' + while try_colidx > 0 && line[try_colidx - 1] =~# '\s\|\d\|#\|,\|:' let try_colidx = try_colidx - 1 - if line[try_colidx] == '#' && colidx == -1 + if line[try_colidx] ==# '#' && colidx == -1 " found hash, where we complete from: let colidx = try_colidx - elseif line[try_colidx] == ':' - if try_colidx > 1 && strpart(line, try_colidx - 2, 3) =~ '\clp:' + elseif line[try_colidx] ==# ':' + if try_colidx > 1 && strpart(line, try_colidx - 2, 3) =~? '\clp:' let g:debchangelog_complete_mode = 'lp' endif break @@ -320,7 +320,7 @@ fun! DebCompleteBugs(findstart, base) return colidx else " return matches: let bug_lines = [] - if g:debchangelog_complete_mode == 'lp' + if g:debchangelog_complete_mode ==? 'lp' if ! has('python') echoerr 'vim must be built with Python support to use LP bug completion' return @@ -363,7 +363,7 @@ EOF for line in bug_lines let parts = matchlist(line, '^\s*\(#\S\+\)\s*-\s*\(.*\)$') " filter only those which match a:base: - if parts[1] !~ "^" . a:base + if parts[1] !~ '^' . a:base continue endif let completion = {} |