Mercurial > vim
comparison runtime/indent/vhdl.vim @ 828:01583c79d5f4 v7.0d03
updated for version 7.0d03
author | vimboss |
---|---|
date | Thu, 13 Apr 2006 20:37:35 +0000 |
parents | 9090f866cd57 |
children | dc8197342755 |
comparison
equal
deleted
inserted
replaced
827:fd1b3406fd1c | 828:01583c79d5f4 |
---|---|
1 " VHDL indent ('93 syntax) | 1 " VHDL indent ('93 syntax) |
2 " Language: VHDL | 2 " Language: VHDL |
3 " Maintainer: Gerald Lai <laigera+vim?gmail.com> | 3 " Maintainer: Gerald Lai <laigera+vim?gmail.com> |
4 " Version: 1.34 | 4 " Version: 1.36 |
5 " Last Change: 2006 Feb 11 | 5 " Last Change: 2006 Apr 12 |
6 " URL: http://www.vim.org/scripts/script.php?script_id=1450 | 6 " URL: http://www.vim.org/scripts/script.php?script_id=1450 |
7 | 7 |
8 " only load this indent file when no other was loaded | 8 " only load this indent file when no other was loaded |
9 if exists("b:did_indent") | 9 if exists("b:did_indent") |
10 finish | 10 finish |
13 | 13 |
14 " setup indent options for local VHDL buffer | 14 " setup indent options for local VHDL buffer |
15 setlocal indentexpr=GetVHDLindent() | 15 setlocal indentexpr=GetVHDLindent() |
16 setlocal indentkeys=!^F,o,O,e,0(,0) | 16 setlocal indentkeys=!^F,o,O,e,0(,0) |
17 setlocal indentkeys+==~if,=~then,=~elsif,=~else | 17 setlocal indentkeys+==~if,=~then,=~elsif,=~else |
18 setlocal indentkeys+==~begin,=~is,=~select,=~-- | 18 setlocal indentkeys+==~begin,=~is,=~select |
19 | 19 |
20 " count repeat | 20 " count repeat |
21 function! <SID>CountWrapper(cmd) | 21 "function! <SID>CountWrapper(cmd) |
22 let i = v:count1 | 22 " let i = v:count1 |
23 if a:cmd[0] == ":" | 23 " if a:cmd[0] == ":" |
24 while i > 0 | 24 " while i > 0 |
25 execute a:cmd | 25 " execute a:cmd |
26 let i = i - 1 | 26 " let i = i - 1 |
27 endwhile | 27 " endwhile |
28 else | 28 " else |
29 execute "normal! gv\<Esc>" | 29 " execute "normal! gv\<Esc>" |
30 execute "normal ".i.a:cmd | 30 " execute "normal ".i.a:cmd |
31 let curcol = col(".") | 31 " let curcol = col(".") |
32 let curline = line(".") | 32 " let curline = line(".") |
33 normal! gv | 33 " normal! gv |
34 call cursor(curline, curcol) | 34 " call cursor(curline, curcol) |
35 endif | 35 " endif |
36 endfunction | 36 "endfunction |
37 | 37 |
38 " explore motion | 38 " explore motion |
39 " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units" | 39 " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units" |
40 let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)' | 40 "let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)' |
41 noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> | 41 "noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> |
42 noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> | 42 "noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> |
43 noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> | 43 "noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> |
44 noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> | 44 "noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> |
45 vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR> | 45 "vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR> |
46 vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR> | 46 "vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR> |
47 vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR> | 47 "vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR> |
48 vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR> | 48 "vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR> |
49 | 49 |
50 " constants | 50 " constants |
51 " not a comment | 51 " not a comment |
52 let s:NC = '\%(--.*\)\@<!' | 52 let s:NC = '\%(--.*\)\@<!' |
53 " end of string | 53 " end of string |
54 let s:ES = '\s*\%(--.*\)\=$' | 54 let s:ES = '\s*\%(--.*\)\=$' |
55 " no "end" keyword in front | 55 " no "end" keyword in front |
56 let s:NE = '\%(\<end\s\+\)\@<!' | 56 let s:NE = '\%(\<end\s\+\)\@<!' |
57 | 57 |
58 " for matchit plugin | 58 " for matchit plugin |
59 if exists("loaded_matchit") | 59 "if exists("loaded_matchit") |
60 let b:match_ignorecase = 1 | 60 " let b:match_ignorecase = 1 |
61 let b:match_words = | 61 " let b:match_words = |
62 \ s:NE.'\<if\>:\<elsif\>:\<else\>:\<end\s\+if\>,'. | 62 " \ s:NE.'\<if\>:\<elsif\>:\<else\>:\<end\s\+if\>,'. |
63 \ s:NE.'\<case\>:\<when\>:\<end\s\+case\>,'. | 63 " \ s:NE.'\<case\>:\<when\>:\<end\s\+case\>,'. |
64 \ s:NE.'\<loop\>:\<end\s\+loop\>,'. | 64 " \ s:NE.'\<loop\>:\<end\s\+loop\>,'. |
65 \ s:NE.'\<for\>:\<end\s\+for\>,'. | 65 " \ s:NE.'\<for\>:\<end\s\+for\>,'. |
66 \ s:NE.'\<generate\>:\<end\s\+generate\>,'. | 66 " \ s:NE.'\<generate\>:\<end\s\+generate\>,'. |
67 \ s:NE.'\<record\>:\<end\s\+record\>,'. | 67 " \ s:NE.'\<record\>:\<end\s\+record\>,'. |
68 \ s:NE.'\<units\>:\<end\s\+units\>,'. | 68 " \ s:NE.'\<units\>:\<end\s\+units\>,'. |
69 \ s:NE.'\<process\>:\<end\s\+process\>,'. | 69 " \ s:NE.'\<process\>:\<end\s\+process\>,'. |
70 \ s:NE.'\<block\>:\<end\s\+block\>,'. | 70 " \ s:NE.'\<block\>:\<end\s\+block\>,'. |
71 \ s:NE.'\<function\>:\<end\s\+function\>,'. | 71 " \ s:NE.'\<function\>:\<end\s\+function\>,'. |
72 \ s:NE.'\<entity\>:\<end\s\+entity\>,'. | 72 " \ s:NE.'\<entity\>:\<end\s\+entity\>,'. |
73 \ s:NE.'\<component\>:\<end\s\+component\>,'. | 73 " \ s:NE.'\<component\>:\<end\s\+component\>,'. |
74 \ s:NE.'\<architecture\>:\<end\s\+architecture\>,'. | 74 " \ s:NE.'\<architecture\>:\<end\s\+architecture\>,'. |
75 \ s:NE.'\<package\>:\<end\s\+package\>,'. | 75 " \ s:NE.'\<package\>:\<end\s\+package\>,'. |
76 \ s:NE.'\<procedure\>:\<end\s\+procedure\>,'. | 76 " \ s:NE.'\<procedure\>:\<end\s\+procedure\>,'. |
77 \ s:NE.'\<configuration\>:\<end\s\+configuration\>' | 77 " \ s:NE.'\<configuration\>:\<end\s\+configuration\>' |
78 endif | 78 "endif |
79 | 79 |
80 " only define indent function once | 80 " only define indent function once |
81 if exists("*GetVHDLindent") | 81 if exists("*GetVHDLindent") |
82 finish | 82 finish |
83 endif | 83 endif |