blob: 74c8e8d1c1c392fa49e0ab3cbc769a9f2381b521 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: Java
Bram Moolenaar1588bc82022-03-08 21:35:07 +00003"
4" This runtime file is looking for a new maintainer.
5"
6" Former maintainer: Dan Sharp
Bram Moolenaar84f72352012-03-11 15:57:40 +01007" Last Change: 2012 Mar 11
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9if exists("b:did_ftplugin") | finish | endif
10let b:did_ftplugin = 1
11
12" Make sure the continuation lines below do not cause problems in
13" compatibility mode.
14let s:save_cpo = &cpo
15set cpo-=C
16
Bram Moolenaar071d4272004-06-13 20:20:40 +000017" For filename completion, prefer the .java extension over the .class
18" extension.
19set suffixes+=.class
20
21" Enable gf on import statements. Convert . in the package
22" name to / and append .java to the name, then search the path.
23setlocal includeexpr=substitute(v:fname,'\\.','/','g')
24setlocal suffixesadd=.java
25if exists("g:ftplugin_java_source_path")
26 let &l:path=g:ftplugin_java_source_path . ',' . &l:path
27endif
28
29" Set 'formatoptions' to break comment lines but not other lines,
30" and insert the comment leader when hitting <CR> or using "o".
31setlocal formatoptions-=t formatoptions+=croql
32
33" Set 'comments' to format dashed lists in comments. Behaves just like C.
34setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
35
36setlocal commentstring=//%s
37
38" Change the :browse e filter to primarily show Java-related files.
39if has("gui_win32")
40 let b:browsefilter="Java Files (*.java)\t*.java\n" .
41 \ "Properties Files (*.prop*)\t*.prop*\n" .
42 \ "Manifest Files (*.mf)\t*.mf\n" .
43 \ "All Files (*.*)\t*.*\n"
44endif
45
46" Undo the stuff we changed.
Bram Moolenaar8b879e72005-03-28 20:49:18 +000047let b:undo_ftplugin = "setlocal suffixes< suffixesadd<" .
Bram Moolenaar071d4272004-06-13 20:20:40 +000048 \ " formatoptions< comments< commentstring< path< includeexpr<" .
49 \ " | unlet! b:browsefilter"
50
51" Restore the saved compatibility options.
52let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010053unlet s:save_cpo