comparison runtime/ftplugin/vhdl.vim @ 33051:02939ae3aaca

runtime: Set b:undo_ftplugin where missing (#12943) Commit: https://github.com/vim/vim/commit/f937ab32a1ac3a560f217ca4ce8305ab2d5b0b74 Author: dkearns <dougkearns@gmail.com> Date: Tue Aug 29 05:32:27 2023 +1000 runtime: Set b:undo_ftplugin where missing (https://github.com/vim/vim/issues/12943) Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 28 Aug 2023 21:45:06 +0200
parents 8b8ef1fed009
children 8ae680be2a51
comparison
equal deleted inserted replaced
33050:6a839ee3ab4b 33051:02939ae3aaca
1 " VHDL filetype plugin 1 " VHDL filetype plugin
2 " Language: VHDL 2 " Language: VHDL
3 " Maintainer: R.Shankar <shankar.pec?gmail.com> 3 " Maintainer: R.Shankar <shankar.pec?gmail.com>
4 " Modified By: Gerald Lai <laigera+vim?gmail.com> 4 " Modified By: Gerald Lai <laigera+vim?gmail.com>
5 " Last Change: 2011 Dec 11 5 " Last Change: 2011 Dec 11
6 " 2023 Aug 28 by Vim Project (undo_ftplugin, commentstring)
6 7
7 " Only do this when not done yet for this buffer 8 " Only do this when not done yet for this buffer
8 if exists("b:did_ftplugin") 9 if exists("b:did_ftplugin")
9 finish 10 finish
10 endif 11 endif
20 "setlocal fo-=t fo+=croqlm1 21 "setlocal fo-=t fo+=croqlm1
21 22
22 " Set 'comments' to format dashed lists in comments. 23 " Set 'comments' to format dashed lists in comments.
23 "setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// 24 "setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
24 25
26 setlocal commentstring=--\ %s
27
25 " Format comments to be up to 78 characters long 28 " Format comments to be up to 78 characters long
26 "setlocal tw=75 29 "setlocal tw=75
30
31 " let b:undo_ftplugin = "setl cms< com< fo< tw<"
32
33 let b:undo_ftplugin = "setl cms< "
27 34
28 " Win32 can filter files in the browse dialog 35 " Win32 can filter files in the browse dialog
29 "if has("gui_win32") && !exists("b:browsefilter") 36 "if has("gui_win32") && !exists("b:browsefilter")
30 " let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . 37 " let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" .
31 " \ "All Files (*.*)\t*.*\n" 38 " \ "All Files (*.*)\t*.*\n"
39 " let b:undo_ftplugin .= " | unlet! b:browsefilter"
32 "endif 40 "endif
33 41
34 " Let the matchit plugin know what items can be matched. 42 " Let the matchit plugin know what items can be matched.
35 if ! exists("b:match_words") && exists("loaded_matchit") 43 if ! exists("b:match_words") && exists("loaded_matchit")
36 let b:match_ignorecase=1 44 let b:match_ignorecase=1
50 \ s:notend.'\<component\>:\<end\s\+component\>,'. 58 \ s:notend.'\<component\>:\<end\s\+component\>,'.
51 \ s:notend.'\<architecture\>:\<end\s\+architecture\>,'. 59 \ s:notend.'\<architecture\>:\<end\s\+architecture\>,'.
52 \ s:notend.'\<package\>:\<end\s\+package\>,'. 60 \ s:notend.'\<package\>:\<end\s\+package\>,'.
53 \ s:notend.'\<procedure\>:\<end\s\+procedure\>,'. 61 \ s:notend.'\<procedure\>:\<end\s\+procedure\>,'.
54 \ s:notend.'\<configuration\>:\<end\s\+configuration\>' 62 \ s:notend.'\<configuration\>:\<end\s\+configuration\>'
63 let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words"
55 endif 64 endif
56 65
57 " count repeat 66 if !exists("no_plugin_maps") && !exists("no_vhdl_maps")
58 function! <SID>CountWrapper(cmd) 67 " count repeat
59 let i = v:count1 68 function! <SID>CountWrapper(cmd)
60 if a:cmd[0] == ":" 69 let i = v:count1
61 while i > 0 70 if a:cmd[0] == ":"
62 execute a:cmd 71 while i > 0
63 let i = i - 1 72 execute a:cmd
64 endwhile 73 let i = i - 1
65 else 74 endwhile
66 execute "normal! gv\<Esc>" 75 else
67 execute "normal ".i.a:cmd 76 execute "normal! gv\<Esc>"
68 let curcol = col(".") 77 execute "normal ".i.a:cmd
69 let curline = line(".") 78 let curcol = col(".")
70 normal! gv 79 let curline = line(".")
71 call cursor(curline, curcol) 80 normal! gv
72 endif 81 call cursor(curline, curcol)
73 endfunction 82 endif
83 endfunction
74 84
75 " explore motion 85 " explore motion
76 " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units" 86 " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units"
77 let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)' 87 let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)'
78 noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> 88 noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR>
79 noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> 89 noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR>
80 noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> 90 noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR>
81 noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> 91 noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR>
82 vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR> 92 vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR>
83 vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR> 93 vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR>
84 vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR> 94 vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR>
85 vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR> 95 vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR>
96 let b:undo_ftplugin .=
97 \ " | silent! execute 'nunmap <buffer> [['" .
98 \ " | silent! execute 'nunmap <buffer> ]]'" .
99 \ " | silent! execute 'nunmap <buffer> []'" .
100 \ " | silent! execute 'nunmap <buffer> ]['" .
101 \ " | silent! execute 'vunmap <buffer> [['" .
102 \ " | silent! execute 'vunmap <buffer> ]]'" .
103 \ " | silent! execute 'vunmap <buffer> []'" .
104 \ " | silent! execute 'vunmap <buffer> ]['"
105 endif
86 106
87 let &cpo = s:cpo_save 107 let &cpo = s:cpo_save
88 unlet s:cpo_save 108 unlet s:cpo_save