blob: cbf30a31854d7baefde901b224c9ade37284b53d [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
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 Moolenaar071d4272004-06-13 20:20:40 +000010
11" Only do this when not done yet for this buffer
12if exists("b:did_ftplugin")
13 finish
14endif
15
16" Don't load another plugin for this buffer
17let b:did_ftplugin = 1
18
Bram Moolenaar5c736222010-01-06 20:54:52 +010019" Set 'cpoptions' to allow line continuations
20let s:cpo_save = &cpo
21set cpo&vim
22
Bram Moolenaar92d640f2005-09-05 22:11:52 +000023" Undo the plugin effect
24let b:undo_ftplugin = "setlocal fo< com< tw<"
Bram Moolenaard68071d2006-05-02 22:08:30 +000025 \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words"
Bram Moolenaar92d640f2005-09-05 22:11:52 +000026
Bram Moolenaar071d4272004-06-13 20:20:40 +000027" Set 'formatoptions' to break comment lines but not other lines,
28" and insert the comment leader when hitting <CR> or using "o".
29setlocal fo-=t fo+=croqlm1
30
31" Set 'comments' to format dashed lists in comments.
32setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
33
34" Format comments to be up to 78 characters long
Bram Moolenaar92d640f2005-09-05 22:11:52 +000035if &textwidth == 0
36 setlocal tw=78
37endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
Bram Moolenaar071d4272004-06-13 20:20:40 +000039" Win32 can filter files in the browse dialog
40if has("gui_win32") && !exists("b:browsefilter")
41 let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" .
42 \ "All Files (*.*)\t*.*\n"
43endif
44
45" Let the matchit plugin know what items can be matched.
46if 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 Moolenaarc572da52017-08-27 16:52:01 +020052 \ '\<if\>:`\@<!\<else\>,' .
Bram Moolenaar071d4272004-06-13 20:20:40 +000053 \ '\<function\>:\<endfunction\>,' .
Bram Moolenaarc572da52017-08-27 16:52:01 +020054 \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' .
Bram Moolenaar071d4272004-06-13 20:20:40 +000055 \ '\<task\>:\<endtask\>,' .
Bram Moolenaarc572da52017-08-27 16:52:01 +020056 \ '\<specify\>:\<endspecify\>,' .
57 \ '\<config\>:\<endconfig\>,' .
58 \ '\<generate\>:\<endgenerate\>,' .
59 \ '\<fork\>:\<join\>,' .
60 \ '\<primitive\>:\<endprimitive\>,' .
61 \ '\<table\>:\<endtable\>'
Bram Moolenaar071d4272004-06-13 20:20:40 +000062endif
Bram Moolenaar5c736222010-01-06 20:54:52 +010063
64" Reset 'cpoptions' back to the user's setting
65let &cpo = s:cpo_save
66unlet s:cpo_save