1" Vim filetype plugin file 2" Language: Verilog HDL 3" Maintainer: Chih-Tsun Huang <[email protected]> 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 <[email protected]> 10 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 19" Set 'cpoptions' to allow line continuations 20let s:cpo_save = &cpo 21set cpo&vim 22 23" Undo the plugin effect 24let b:undo_ftplugin = "setlocal fo< com< tw<" 25 \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words" 26 27" 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 35if &textwidth == 0 36 setlocal tw=78 37endif 38 39" 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\>,' . 52 \ '\<if\>:`\@<!\<else\>,' . 53 \ '\<function\>:\<endfunction\>,' . 54 \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' . 55 \ '\<task\>:\<endtask\>,' . 56 \ '\<specify\>:\<endspecify\>,' . 57 \ '\<config\>:\<endconfig\>,' . 58 \ '\<generate\>:\<endgenerate\>,' . 59 \ '\<fork\>:\<join\>,' . 60 \ '\<primitive\>:\<endprimitive\>,' . 61 \ '\<table\>:\<endtable\>' 62endif 63 64" Reset 'cpoptions' back to the user's setting 65let &cpo = s:cpo_save 66unlet s:cpo_save 67