Bram Moolenaar | 1ef15e3 | 2006-02-01 21:56:25 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: Javascript |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 3 | " Maintainer: Doug Kearns <dougkearns@gmail.com> |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 4 | " Last Change: 2008 Jun 15 |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 5 | " URL: http://gus.gscit.monash.edu.au/~djkea2/vim/ftplugin/javascript.vim |
Bram Moolenaar | 1ef15e3 | 2006-02-01 21:56:25 +0000 | [diff] [blame] | 6 | |
| 7 | if exists("b:did_ftplugin") |
| 8 | finish |
| 9 | endif |
| 10 | let b:did_ftplugin = 1 |
| 11 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 12 | let s:cpo_save = &cpo |
| 13 | set 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". |
| 17 | setlocal formatoptions-=t formatoptions+=croql |
| 18 | |
| 19 | " Set completion with CTRL-X CTRL-O to autoloaded function. |
Bram Moolenaar | 1ef15e3 | 2006-02-01 21:56:25 +0000 | [diff] [blame] | 20 | if exists('&ofu') |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 21 | setlocal omnifunc=javascriptcomplete#CompleteJS |
Bram Moolenaar | 1ef15e3 | 2006-02-01 21:56:25 +0000 | [diff] [blame] | 22 | endif |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 23 | |
| 24 | " Set 'comments' to format dashed lists in comments. |
| 25 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// |
| 26 | |
| 27 | setlocal commentstring=//%s |
| 28 | |
| 29 | " Change the :browse e filter to primarily show Java-related files. |
| 30 | if has("gui_win32") |
Bram Moolenaar | 864207d | 2008-06-24 22:14:38 +0000 | [diff] [blame] | 31 | let b:browsefilter="Javascript Files (*.js)\t*.js\n" . |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 32 | \ "All Files (*.*)\t*.*\n" |
| 33 | endif |
| 34 | |
| 35 | let b:undo_ftplugin = "setl fo< ofu< com< cms<" |
| 36 | |
| 37 | let &cpo = s:cpo_save |
| 38 | unlet s:cpo_save |