vim: update release.sh to vim 7.3
[msysgit/mtrensch.git] / share / vim / vim72 / ftplugin / vhdl.vim
blob08a2de3399f60657aa1c167e1d52e90693d5ef33
1 " VHDL filetype plugin
2 " Language:    VHDL
3 " Maintainer:  R.Shankar <shankar.r?freescale.com>
4 " Modified By: Gerald Lai <laigera+vim?gmail.com>
5 " Last Change: 2006 Feb 16
7 " Only do this when not done yet for this buffer
8 if exists("b:did_ftplugin")
9   finish
10 endif
12 " Don't load another plugin for this buffer
13 let b:did_ftplugin = 1
15 " Set 'formatoptions' to break comment lines but not other lines,
16 " and insert the comment leader when hitting <CR> or using "o".
17 "setlocal fo-=t fo+=croqlm1
19 " Set 'comments' to format dashed lists in comments.
20 "setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
22 " Format comments to be up to 78 characters long
23 "setlocal tw=75
25 set cpo-=C
27 " Win32 can filter files in the browse dialog
28 "if has("gui_win32") && !exists("b:browsefilter")
29 "  let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" .
30 "   \ "All Files (*.*)\t*.*\n"
31 "endif
33 " Let the matchit plugin know what items can be matched.
34 if ! exists("b:match_words")  &&  exists("loaded_matchit")
35   let b:match_ignorecase=1
36   let s:notend = '\%(\<end\s\+\)\@<!'
37   let b:match_words =
38     \ s:notend.'\<if\>:\<elsif\>:\<else\>:\<end\s\+if\>,'.
39     \ s:notend.'\<case\>:\<when\>:\<end\s\+case\>,'.
40     \ s:notend.'\<loop\>:\<end\s\+loop\>,'.
41     \ s:notend.'\<for\>:\<end\s\+for\>,'.
42     \ s:notend.'\<generate\>:\<end\s\+generate\>,'.
43     \ s:notend.'\<record\>:\<end\s\+record\>,'.
44     \ s:notend.'\<units\>:\<end\s\+units\>,'.
45     \ s:notend.'\<process\>:\<end\s\+process\>,'.
46     \ s:notend.'\<block\>:\<end\s\+block\>,'.
47     \ s:notend.'\<function\>:\<end\s\+function\>,'.
48     \ s:notend.'\<entity\>:\<end\s\+entity\>,'.
49     \ s:notend.'\<component\>:\<end\s\+component\>,'.
50     \ s:notend.'\<architecture\>:\<end\s\+architecture\>,'.
51     \ s:notend.'\<package\>:\<end\s\+package\>,'.
52     \ s:notend.'\<procedure\>:\<end\s\+procedure\>,'.
53     \ s:notend.'\<configuration\>:\<end\s\+configuration\>'
54 endif
56 " count repeat
57 function! <SID>CountWrapper(cmd)
58   let i = v:count1
59   if a:cmd[0] == ":"
60     while i > 0
61       execute a:cmd
62       let i = i - 1
63     endwhile
64   else
65     execute "normal! gv\<Esc>"
66     execute "normal ".i.a:cmd
67     let curcol = col(".")
68     let curline = line(".")
69     normal! gv
70     call cursor(curline, curcol)
71   endif
72 endfunction
74 " explore motion
75 " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units"
76 let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)'
77 noremap  <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR>
78 noremap  <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR>
79 noremap  <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR>
80 noremap  <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR>
81 vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR>
82 vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR>
83 vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR>
84 vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR>