summaryrefslogtreecommitdiffstats
path: root/runtime/ftplugin/debchangelog.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ftplugin/debchangelog.vim')
-rw-r--r--runtime/ftplugin/debchangelog.vim101
1 files changed, 56 insertions, 45 deletions
diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim
index a78f7811f1..cf8dd17c44 100644
--- a/runtime/ftplugin/debchangelog.vim
+++ b/runtime/ftplugin/debchangelog.vim
@@ -1,9 +1,9 @@
" Vim filetype plugin file (GUI menu, folding and completion)
" Language: Debian Changelog
-" Maintainer: Debian Vim Maintainers
+" Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org>
" Former Maintainers: Michael Piefel <piefel@informatik.hu-berlin.de>
" Stefano Zacchiroli <zack@debian.org>
-" Last Change: 2018-01-28
+" Last Change: 2022 Jul 25
" License: Vim License
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim
@@ -35,6 +35,11 @@ if exists('g:did_changelog_ftplugin')
finish
endif
+" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise
+" <CR> would not be recognized. See ":help 'cpoptions'".
+let s:cpo_save = &cpo
+set cpo&vim
+
" Don't load another plugin (this is global)
let g:did_changelog_ftplugin = 1
@@ -101,13 +106,13 @@ endfunction
" These functions implement the menus
function NewVersion()
" The new entry is unfinalised and shall be changed
- amenu disable Changelog.New\ Version
- amenu enable Changelog.Add\ Entry
- amenu enable Changelog.Close\ Bug
- amenu enable Changelog.Set\ Distribution
- amenu enable Changelog.Set\ Urgency
- amenu disable Changelog.Unfinalise
- amenu enable Changelog.Finalise
+ amenu disable &Changelog.&New\ Version
+ amenu enable &Changelog.&Add\ Entry
+ amenu enable &Changelog.&Close\ Bug
+ amenu enable &Changelog.Set\ &Distribution
+ amenu enable &Changelog.Set\ &Urgency
+ amenu disable &Changelog.U&nfinalise
+ amenu enable &Changelog.&Finalise
call append(0, substitute(getline(1), '-\([[:digit:]]\+\))', '-$$\1)', ''))
call append(1, '')
call append(2, '')
@@ -117,7 +122,9 @@ function NewVersion()
normal! 1G0
call search(')')
normal! h
- normal! 
+ " ':normal' doens't support key annotation (<c-a>) directly.
+ " Vim's manual recommends using ':exe' to use key annotation indirectly (backslash-escaping needed though).
+ exe "normal! \<c-a>"
call setline(1, substitute(getline(1), '-\$\$', '-', ''))
if exists('g:debchangelog_fold_enable')
foldopen
@@ -161,13 +168,13 @@ endfunction
function <SID>UnfinaliseMenu()
" This means the entry shall be changed
- amenu disable Changelog.New\ Version
- amenu enable Changelog.Add\ Entry
- amenu enable Changelog.Close\ Bug
- amenu enable Changelog.Set\ Distribution
- amenu enable Changelog.Set\ Urgency
- amenu disable Changelog.Unfinalise
- amenu enable Changelog.Finalise
+ amenu disable &Changelog.&New\ Version
+ amenu enable &Changelog.&Add\ Entry
+ amenu enable &Changelog.&Close\ Bug
+ amenu enable &Changelog.Set\ &Distribution
+ amenu enable &Changelog.Set\ &Urgency
+ amenu disable &Changelog.U&nfinalise
+ amenu enable &Changelog.&Finalise
endfunction
function Unfinalise()
@@ -179,13 +186,13 @@ endfunction
function <SID>FinaliseMenu()
" This means the entry should not be changed anymore
- amenu enable Changelog.New\ Version
- amenu disable Changelog.Add\ Entry
- amenu disable Changelog.Close\ Bug
- amenu disable Changelog.Set\ Distribution
- amenu disable Changelog.Set\ Urgency
- amenu enable Changelog.Unfinalise
- amenu disable Changelog.Finalise
+ amenu enable &Changelog.&New\ Version
+ amenu disable &Changelog.&Add\ Entry
+ amenu disable &Changelog.&Close\ Bug
+ amenu disable &Changelog.Set\ &Distribution
+ amenu disable &Changelog.Set\ &Urgency
+ amenu enable &Changelog.U&nfinalise
+ amenu disable &Changelog.&Finalise
endfunction
function Finalise()
@@ -198,26 +205,26 @@ endfunction
function <SID>MakeMenu()
amenu &Changelog.&New\ Version :call NewVersion()<CR>
- amenu Changelog.&Add\ Entry :call AddEntry()<CR>
- amenu Changelog.&Close\ Bug :call CloseBug()<CR>
- menu Changelog.-sep- <nul>
-
- amenu Changelog.Set\ &Distribution.&unstable :call Distribution("unstable")<CR>
- amenu Changelog.Set\ Distribution.&frozen :call Distribution("frozen")<CR>
- amenu Changelog.Set\ Distribution.&stable :call Distribution("stable")<CR>
- menu Changelog.Set\ Distribution.-sep- <nul>
- amenu Changelog.Set\ Distribution.frozen\ unstable :call Distribution("frozen unstable")<CR>
- amenu Changelog.Set\ Distribution.stable\ unstable :call Distribution("stable unstable")<CR>
- amenu Changelog.Set\ Distribution.stable\ frozen :call Distribution("stable frozen")<CR>
- amenu Changelog.Set\ Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable")<CR>
-
- amenu Changelog.Set\ &Urgency.&low :call Urgency("low")<CR>
- amenu Changelog.Set\ Urgency.&medium :call Urgency("medium")<CR>
- amenu Changelog.Set\ Urgency.&high :call Urgency("high")<CR>
-
- menu Changelog.-sep- <nul>
- amenu Changelog.U&nfinalise :call Unfinalise()<CR>
- amenu Changelog.&Finalise :call Finalise()<CR>
+ amenu &Changelog.&Add\ Entry :call AddEntry()<CR>
+ amenu &Changelog.&Close\ Bug :call CloseBug()<CR>
+ menu &Changelog.-sep- <nul>
+
+ amenu &Changelog.Set\ &Distribution.&unstable :call Distribution("unstable")<CR>
+ amenu &Changelog.Set\ &Distribution.&frozen :call Distribution("frozen")<CR>
+ amenu &Changelog.Set\ &Distribution.&stable :call Distribution("stable")<CR>
+ menu &Changelog.Set\ &Distribution.-sep- <nul>
+ amenu &Changelog.Set\ &Distribution.frozen\ unstable :call Distribution("frozen unstable")<CR>
+ amenu &Changelog.Set\ &Distribution.stable\ unstable :call Distribution("stable unstable")<CR>
+ amenu &Changelog.Set\ &Distribution.stable\ frozen :call Distribution("stable frozen")<CR>
+ amenu &Changelog.Set\ &Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable")<CR>
+
+ amenu &Changelog.Set\ &Urgency.&low :call Urgency("low")<CR>
+ amenu &Changelog.Set\ &Urgency.&medium :call Urgency("medium")<CR>
+ amenu &Changelog.Set\ &Urgency.&high :call Urgency("high")<CR>
+
+ menu &Changelog.-sep- <nul>
+ amenu &Changelog.U&nfinalise :call Unfinalise()<CR>
+ amenu &Changelog.&Finalise :call Finalise()<CR>
if <SID>Finalised()
call <SID>FinaliseMenu()
@@ -228,7 +235,7 @@ endfunction
augroup changelogMenu
au BufEnter * if &filetype == "debchangelog" | call <SID>MakeMenu() | endif
-au BufLeave * if &filetype == "debchangelog" | silent! aunmenu Changelog | endif
+au BufLeave * if &filetype == "debchangelog" | silent! aunmenu &Changelog | endif
augroup END
" }}}
@@ -380,4 +387,8 @@ setlocal omnifunc=DebCompleteBugs
" }}}
+" Restore the previous value of 'cpoptions'.
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
" vim: set foldmethod=marker: