Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: Verilog HDL |
| 3 | " Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw> |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 4 | " Last Change: Mon Sep 5 11:05:54 CST 2005 and 2006 April 30 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | " URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim |
| 6 | |
| 7 | " Only do this when not done yet for this buffer |
| 8 | if exists("b:did_ftplugin") |
| 9 | finish |
| 10 | endif |
| 11 | |
| 12 | " Don't load another plugin for this buffer |
| 13 | let b:did_ftplugin = 1 |
| 14 | |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 15 | " Undo the plugin effect |
| 16 | let b:undo_ftplugin = "setlocal fo< com< tw<" |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 17 | \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words" |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 18 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | " Set 'formatoptions' to break comment lines but not other lines, |
| 20 | " and insert the comment leader when hitting <CR> or using "o". |
| 21 | setlocal fo-=t fo+=croqlm1 |
| 22 | |
| 23 | " Set 'comments' to format dashed lists in comments. |
| 24 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// |
| 25 | |
| 26 | " Format comments to be up to 78 characters long |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 27 | if &textwidth == 0 |
| 28 | setlocal tw=78 |
| 29 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 30 | |
| 31 | set cpo-=C |
| 32 | |
| 33 | " Win32 can filter files in the browse dialog |
| 34 | if has("gui_win32") && !exists("b:browsefilter") |
| 35 | let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . |
| 36 | \ "All Files (*.*)\t*.*\n" |
| 37 | endif |
| 38 | |
| 39 | " Let the matchit plugin know what items can be matched. |
| 40 | if exists("loaded_matchit") |
| 41 | let b:match_ignorecase=0 |
| 42 | let b:match_words= |
| 43 | \ '\<begin\>:\<end\>,' . |
| 44 | \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' . |
| 45 | \ '\<module\>:\<endmodule\>,' . |
| 46 | \ '\<if\>:\<else\>,' . |
| 47 | \ '\<function\>:\<endfunction\>,' . |
| 48 | \ '`ifdef\>:`else\>:`endif\>,' . |
| 49 | \ '\<task\>:\<endtask\>,' . |
| 50 | \ '\<specify\>:\<endspecify\>' |
| 51 | endif |