blob: 83c3754e05806d4fac0a2259de621d9deec53af9 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: Verilog HDL
Bram Moolenaarc572da52017-08-27 16:52:01 +02003" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw>
4" Last Change: 2017 Aug 25 by Chih-Tsun Huang
Doug Kearns93197fd2024-01-14 20:59:02 +01005" 2024 Jan 14 by Vim Project (browsefilter)
Bram Moolenaarc572da52017-08-27 16:52:01 +02006" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim
7"
8" Credits:
9" Suggestions for improvement, bug reports by
10" Shao <shaominghai2005@163.com>
Bram Moolenaar071d4272004-06-13 20:20:40 +000011
12" Only do this when not done yet for this buffer
13if exists("b:did_ftplugin")
14 finish
15endif
16
17" Don't load another plugin for this buffer
18let b:did_ftplugin = 1
19
Bram Moolenaar5c736222010-01-06 20:54:52 +010020" Set 'cpoptions' to allow line continuations
21let s:cpo_save = &cpo
22set cpo&vim
23
Bram Moolenaar92d640f2005-09-05 22:11:52 +000024" Undo the plugin effect
25let b:undo_ftplugin = "setlocal fo< com< tw<"
Bram Moolenaard68071d2006-05-02 22:08:30 +000026 \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words"
Bram Moolenaar92d640f2005-09-05 22:11:52 +000027
Bram Moolenaar071d4272004-06-13 20:20:40 +000028" Set 'formatoptions' to break comment lines but not other lines,
29" and insert the comment leader when hitting <CR> or using "o".
30setlocal fo-=t fo+=croqlm1
31
32" Set 'comments' to format dashed lists in comments.
33setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
34
35" Format comments to be up to 78 characters long
Bram Moolenaar92d640f2005-09-05 22:11:52 +000036if &textwidth == 0
37 setlocal tw=78
38endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000039
Doug Kearns93197fd2024-01-14 20:59:02 +010040" Win32 and GTK can filter files in the browse dialog
41if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
42 let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n"
43 if has("win32")
44 let b:browsefilter .= "All Files (*.*)\t*\n"
45 else
46 let b:browsefilter .= "All Files (*)\t*\n"
47 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000048endif
49
50" Let the matchit plugin know what items can be matched.
51if exists("loaded_matchit")
52 let b:match_ignorecase=0
53 let b:match_words=
54 \ '\<begin\>:\<end\>,' .
55 \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' .
56 \ '\<module\>:\<endmodule\>,' .
Bram Moolenaarc572da52017-08-27 16:52:01 +020057 \ '\<if\>:`\@<!\<else\>,' .
Bram Moolenaar071d4272004-06-13 20:20:40 +000058 \ '\<function\>:\<endfunction\>,' .
Bram Moolenaarc572da52017-08-27 16:52:01 +020059 \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' .
Bram Moolenaar071d4272004-06-13 20:20:40 +000060 \ '\<task\>:\<endtask\>,' .
Bram Moolenaarc572da52017-08-27 16:52:01 +020061 \ '\<specify\>:\<endspecify\>,' .
62 \ '\<config\>:\<endconfig\>,' .
63 \ '\<generate\>:\<endgenerate\>,' .
64 \ '\<fork\>:\<join\>,' .
65 \ '\<primitive\>:\<endprimitive\>,' .
66 \ '\<table\>:\<endtable\>'
Bram Moolenaar071d4272004-06-13 20:20:40 +000067endif
Bram Moolenaar5c736222010-01-06 20:54:52 +010068
69" Reset 'cpoptions' back to the user's setting
70let &cpo = s:cpo_save
71unlet s:cpo_save