annotate runtime/ftplugin/java.vim @ 34134:8ae680be2a51

runtime(ftplugin): Use "*" browsefilter pattern to match "All Files" Commit: https://github.com/vim/vim/commit/93197fde0f1db09b1e495cf3eb14a8f42c318b80 Author: Doug Kearns <dougkearns@gmail.com> Date: Sun Jan 14 20:59:02 2024 +0100 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files" Problem: The "*.*" browsefilter pattern only matches all files on Windows (Daryl Lee) Solution: Use "*" to filter on all platforms but keep "*.*" as the label text on Windows. (Fixes #12685, Doug Kearns) The *.* browsefilter pattern used to match "All Files" on Windows is a legacy of the DOS 8.3 filename wildcard matching algorithm. For reasons of backward compatibility this still works on Windows to match all files, even those without an extension. However, this pattern only matches filenames containing a dot on other platforms. This often makes files without an extension difficult to access from the file dialog, e.g., "Makefile" On Windows it is still standard practice to use "*.*" for the filter label so ftplugins should use "All Files (*.*)" on Windows and "All Files (*)" on other platforms. This matches Vim's default browsefilter values. This commit also normalises the browsefilter conditional test to check for the Win32 and GTK GUI features and an unset b:browsefilter. closes: #12759 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 14 Jan 2024 21:15:03 +0100
parents c968191a8557
children c95bcbccb165
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim filetype plugin file
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
2 " Language: Java
28010
c968191a8557 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
3 "
c968191a8557 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
4 " This runtime file is looking for a new maintainer.
c968191a8557 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
5 "
c968191a8557 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
6 " Former maintainer: Dan Sharp
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
7 " Last Change: 2012 Mar 11
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
8 " 2024 Jan 14 by Vim Project (browsefilter)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 if exists("b:did_ftplugin") | finish | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " Make sure the continuation lines below do not cause problems in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " compatibility mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 let s:save_cpo = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 set cpo-=C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " For filename completion, prefer the .java extension over the .class
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " extension.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 set suffixes+=.class
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " Enable gf on import statements. Convert . in the package
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " name to / and append .java to the name, then search the path.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 setlocal includeexpr=substitute(v:fname,'\\.','/','g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 setlocal suffixesadd=.java
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 if exists("g:ftplugin_java_source_path")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let &l:path=g:ftplugin_java_source_path . ',' . &l:path
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " Set 'formatoptions' to break comment lines but not other lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " and insert the comment leader when hitting <CR> or using "o".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 setlocal formatoptions-=t formatoptions+=croql
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " Set 'comments' to format dashed lists in comments. Behaves just like C.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 setlocal commentstring=//%s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " Change the :browse e filter to primarily show Java-related files.
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
40 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 let b:browsefilter="Java Files (*.java)\t*.java\n" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 \ "Properties Files (*.prop*)\t*.prop*\n" .
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
43 \ "Manifest Files (*.mf)\t*.mf\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
44 if has("win32")
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
45 let b:browsefilter .= "All Files (*.*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
46 else
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
47 let b:browsefilter .= "All Files (*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 28010
diff changeset
48 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " Undo the stuff we changed.
232
41e7594cac8b updated for version 7.0065
vimboss
parents: 7
diff changeset
52 let b:undo_ftplugin = "setlocal suffixes< suffixesadd<" .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 \ " formatoptions< comments< commentstring< path< includeexpr<" .
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 \ " | unlet! b:browsefilter"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 " Restore the saved compatibility options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 let &cpo = s:save_cpo
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
58 unlet s:save_cpo