Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: Verilog HDL |
Bram Moolenaar | c572da5 | 2017-08-27 16:52:01 +0200 | [diff] [blame] | 3 | " Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw> |
| 4 | " Last Change: 2017 Aug 25 by Chih-Tsun Huang |
| 5 | " URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim |
| 6 | " |
| 7 | " Credits: |
| 8 | " Suggestions for improvement, bug reports by |
| 9 | " Shao <shaominghai2005@163.com> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 10 | |
| 11 | " Only do this when not done yet for this buffer |
| 12 | if exists("b:did_ftplugin") |
| 13 | finish |
| 14 | endif |
| 15 | |
| 16 | " Don't load another plugin for this buffer |
| 17 | let b:did_ftplugin = 1 |
| 18 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 19 | " Set 'cpoptions' to allow line continuations |
| 20 | let s:cpo_save = &cpo |
| 21 | set cpo&vim |
| 22 | |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 23 | " Undo the plugin effect |
| 24 | let b:undo_ftplugin = "setlocal fo< com< tw<" |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 25 | \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words" |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 26 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 27 | " Set 'formatoptions' to break comment lines but not other lines, |
| 28 | " and insert the comment leader when hitting <CR> or using "o". |
| 29 | setlocal fo-=t fo+=croqlm1 |
| 30 | |
| 31 | " Set 'comments' to format dashed lists in comments. |
| 32 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// |
| 33 | |
| 34 | " Format comments to be up to 78 characters long |
Bram Moolenaar | 92d640f | 2005-09-05 22:11:52 +0000 | [diff] [blame] | 35 | if &textwidth == 0 |
| 36 | setlocal tw=78 |
| 37 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 38 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 39 | " Win32 can filter files in the browse dialog |
| 40 | if has("gui_win32") && !exists("b:browsefilter") |
| 41 | let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . |
| 42 | \ "All Files (*.*)\t*.*\n" |
| 43 | endif |
| 44 | |
| 45 | " Let the matchit plugin know what items can be matched. |
| 46 | if exists("loaded_matchit") |
| 47 | let b:match_ignorecase=0 |
| 48 | let b:match_words= |
| 49 | \ '\<begin\>:\<end\>,' . |
| 50 | \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' . |
| 51 | \ '\<module\>:\<endmodule\>,' . |
Bram Moolenaar | c572da5 | 2017-08-27 16:52:01 +0200 | [diff] [blame] | 52 | \ '\<if\>:`\@<!\<else\>,' . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 53 | \ '\<function\>:\<endfunction\>,' . |
Bram Moolenaar | c572da5 | 2017-08-27 16:52:01 +0200 | [diff] [blame] | 54 | \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 55 | \ '\<task\>:\<endtask\>,' . |
Bram Moolenaar | c572da5 | 2017-08-27 16:52:01 +0200 | [diff] [blame] | 56 | \ '\<specify\>:\<endspecify\>,' . |
| 57 | \ '\<config\>:\<endconfig\>,' . |
| 58 | \ '\<generate\>:\<endgenerate\>,' . |
| 59 | \ '\<fork\>:\<join\>,' . |
| 60 | \ '\<primitive\>:\<endprimitive\>,' . |
| 61 | \ '\<table\>:\<endtable\>' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 62 | endif |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 63 | |
| 64 | " Reset 'cpoptions' back to the user's setting |
| 65 | let &cpo = s:cpo_save |
| 66 | unlet s:cpo_save |