verilog.vim 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. " Vim filetype plugin file
  2. " Language: Verilog HDL
  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>
  10. " Only do this when not done yet for this buffer
  11. if exists("b:did_ftplugin")
  12. finish
  13. endif
  14. " Don't load another plugin for this buffer
  15. let b:did_ftplugin = 1
  16. " Set 'cpoptions' to allow line continuations
  17. let s:cpo_save = &cpo
  18. set cpo&vim
  19. " Undo the plugin effect
  20. let b:undo_ftplugin = "setlocal fo< com< tw<"
  21. \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words"
  22. " Set 'formatoptions' to break comment lines but not other lines,
  23. " and insert the comment leader when hitting <CR> or using "o".
  24. setlocal fo-=t fo+=croqlm1
  25. " Set 'comments' to format dashed lists in comments.
  26. setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
  27. " Format comments to be up to 78 characters long
  28. if &textwidth == 0
  29. setlocal tw=78
  30. endif
  31. " Win32 can filter files in the browse dialog
  32. if has("gui_win32") && !exists("b:browsefilter")
  33. let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" .
  34. \ "All Files (*.*)\t*.*\n"
  35. endif
  36. " Let the matchit plugin know what items can be matched.
  37. if exists("loaded_matchit")
  38. let b:match_ignorecase=0
  39. let b:match_words=
  40. \ '\<begin\>:\<end\>,' .
  41. \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' .
  42. \ '\<module\>:\<endmodule\>,' .
  43. \ '\<if\>:`\@<!\<else\>,' .
  44. \ '\<function\>:\<endfunction\>,' .
  45. \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' .
  46. \ '\<task\>:\<endtask\>,' .
  47. \ '\<specify\>:\<endspecify\>,' .
  48. \ '\<config\>:\<endconfig\>,' .
  49. \ '\<generate\>:\<endgenerate\>,' .
  50. \ '\<fork\>:\<join\>,' .
  51. \ '\<primitive\>:\<endprimitive\>,' .
  52. \ '\<table\>:\<endtable\>'
  53. endif
  54. " Reset 'cpoptions' back to the user's setting
  55. let &cpo = s:cpo_save
  56. unlet s:cpo_save