blob: af5e4a920c8c95a850e0280748270c95d4a78942 [file] [log] [blame]
Bram Moolenaar1ef15e32006-02-01 21:56:25 +00001" Vim filetype plugin file
2" Language: Javascript
Bram Moolenaarc81e5e72007-05-05 18:24:42 +00003" Maintainer: Doug Kearns <dougkearns@gmail.com>
Bram Moolenaar864207d2008-06-24 22:14:38 +00004" Last Change: 2008 Jun 15
Bram Moolenaarc81e5e72007-05-05 18:24:42 +00005" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/ftplugin/javascript.vim
Bram Moolenaar1ef15e32006-02-01 21:56:25 +00006
7if exists("b:did_ftplugin")
8 finish
9endif
10let b:did_ftplugin = 1
11
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000012let s:cpo_save = &cpo
13set cpo-=C
14
15" Set 'formatoptions' to break comment lines but not other lines,
16" " and insert the comment leader when hitting <CR> or using "o".
17setlocal formatoptions-=t formatoptions+=croql
18
19" Set completion with CTRL-X CTRL-O to autoloaded function.
Bram Moolenaar1ef15e32006-02-01 21:56:25 +000020if exists('&ofu')
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000021 setlocal omnifunc=javascriptcomplete#CompleteJS
Bram Moolenaar1ef15e32006-02-01 21:56:25 +000022endif
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000023
24" Set 'comments' to format dashed lists in comments.
25setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
26
27setlocal commentstring=//%s
28
29" Change the :browse e filter to primarily show Java-related files.
30if has("gui_win32")
Bram Moolenaar864207d2008-06-24 22:14:38 +000031 let b:browsefilter="Javascript Files (*.js)\t*.js\n" .
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000032 \ "All Files (*.*)\t*.*\n"
33endif
34
35let b:undo_ftplugin = "setl fo< ofu< com< cms<"
36
37let &cpo = s:cpo_save
38unlet s:cpo_save