javascript.vim 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. " Vim filetype plugin file
  2. " Language: Javascript
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Last Change: 2008 Jun 15
  5. " URL: http://gus.gscit.monash.edu.au/~djkea2/vim/ftplugin/javascript.vim
  6. if exists("b:did_ftplugin")
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let s:cpo_save = &cpo
  11. set cpo-=C
  12. " Set 'formatoptions' to break comment lines but not other lines,
  13. " " and insert the comment leader when hitting <CR> or using "o".
  14. setlocal formatoptions-=t formatoptions+=croql
  15. " Set completion with CTRL-X CTRL-O to autoloaded function.
  16. if exists('&ofu')
  17. setlocal omnifunc=javascriptcomplete#CompleteJS
  18. endif
  19. " Set 'comments' to format dashed lists in comments.
  20. setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
  21. setlocal commentstring=//%s
  22. " Change the :browse e filter to primarily show Java-related files.
  23. if has("gui_win32")
  24. let b:browsefilter="Javascript Files (*.js)\t*.js\n" .
  25. \ "All Files (*.*)\t*.*\n"
  26. endif
  27. let b:undo_ftplugin = "setl fo< ofu< com< cms<"
  28. let &cpo = s:cpo_save
  29. unlet s:cpo_save