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