annotate runtime/ftplugin/html.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 67f31c24291b
children 7c7432a53a6c
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
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
2 " Language: HTML
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
4 " Previous Maintainer: Dan Sharp
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
5 " Last Change: 2024 Jan 14
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
7 if exists("b:did_ftplugin")
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
8 finish
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
9 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 let s:save_cpo = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 set cpo-=C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1619
diff changeset
15 setlocal matchpairs+=<:>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 setlocal commentstring=<!--%s-->
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1619
diff changeset
17 setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1619
diff changeset
18
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
19 let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<"
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
20
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
21 if get(g:, "ft_html_autocomment", 0)
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
22 setlocal formatoptions-=t formatoptions+=croql
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
23 let b:undo_ftplugin ..= " | setlocal formatoptions<"
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1619
diff changeset
24 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1619
diff changeset
25
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
26 if exists('&omnifunc')
6009
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
27 setlocal omnifunc=htmlcomplete#CompleteTags
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
28 call htmlcomplete#DetectOmniFlavor()
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
29 let b:undo_ftplugin ..= " | setlocal omnifunc<"
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 841
diff changeset
30 endif
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 523
diff changeset
31
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
32 " HTML: thanks to Johannes Zellner and Benji Fisher.
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
33 if exists("loaded_matchit") && !exists("b:match_words")
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
34 let b:match_ignorecase = 1
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
35 let b:match_words = '<!--:-->,' ..
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
36 \ '<:>,' ..
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
37 \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' ..
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
38 \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' ..
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
39 \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
40 let b:html_set_match_words = 1
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
41 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words b:html_set_match_words"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Change the :browse e filter to primarily show HTML-related files.
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
45 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
46 let b:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" ..
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
47 \ "JavaScript Files (*.js)\t*.js\n" ..
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
48 \ "Cascading StyleSheets (*.css)\t*.css\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
49 if has("win32")
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
50 let b:browsefilter ..= "All Files (*.*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
51 else
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
52 let b:browsefilter ..= "All Files (*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 29450
diff changeset
53 endif
29450
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
54 let b:html_set_browsefilter = 1
67f31c24291b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28010
diff changeset
55 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 let &cpo = s:save_cpo
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
59 unlet s:save_cpo