Mercurial > vim
annotate runtime/ftplugin/haml.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 | 5c40013d45ee |
children |
rev | line source |
---|---|
1668 | 1 " Vim filetype plugin |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
2 " Language: Haml |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
18818 | 4 " Last Change: 2019 Dec 05 |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
5 " 2024 Jan 14 by Vim Project (browsefilter) |
1668 | 6 |
7 " Only do this when not done yet for this buffer | |
8 if exists("b:did_ftplugin") | |
9 finish | |
10 endif | |
11 | |
12 let s:save_cpo = &cpo | |
13 set cpo-=C | |
14 | |
15 " Define some defaults in case the included ftplugins don't set them. | |
16 let s:undo_ftplugin = "" | |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
17 if has("win32") |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
18 let s:browsefilter = "All Files (*.*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
19 else |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
20 let s:browsefilter = "All Files (*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
21 endif |
1668 | 22 let s:match_words = "" |
23 | |
24 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim | |
25 unlet! b:did_ftplugin | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
26 set matchpairs-=<:> |
1668 | 27 |
28 " Override our defaults if these were set by an included ftplugin. | |
29 if exists("b:undo_ftplugin") | |
30 let s:undo_ftplugin = b:undo_ftplugin | |
31 unlet b:undo_ftplugin | |
32 endif | |
33 if exists("b:browsefilter") | |
34 let s:browsefilter = b:browsefilter | |
35 unlet b:browsefilter | |
36 endif | |
37 if exists("b:match_words") | |
38 let s:match_words = b:match_words | |
39 unlet b:match_words | |
40 endif | |
41 | |
42 runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim | |
43 let b:did_ftplugin = 1 | |
44 | |
18818 | 45 let &l:define .= empty(&l:define ? '' : '\|') . '^\s*\%(%\w*\)\=\%(\.[[:alnum:]_-]\+\)*#' |
46 | |
1668 | 47 " Combine the new set of values with those previously included. |
48 if exists("b:undo_ftplugin") | |
49 let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin | |
50 endif | |
51 if exists ("b:browsefilter") | |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
52 let s:browsefilter = substitute(b:browsefilter,'\cAll Files (.*)\t\*\n','','') . s:browsefilter |
1668 | 53 endif |
54 if exists("b:match_words") | |
55 let s:match_words = b:match_words . ',' . s:match_words | |
56 endif | |
57 | |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
58 " Change the browse dialog on Win32 and GTK to show mainly Haml-related files |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
59 if has("gui_win32") || has("gui_gtk") |
1668 | 60 let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter |
61 endif | |
62 | |
63 " Load the combined list of match_words for matchit.vim | |
64 if exists("loaded_matchit") | |
65 let b:match_words = s:match_words | |
66 endif | |
67 | |
2202 | 68 setlocal comments= commentstring=-#\ %s |
1668 | 69 |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
18818
diff
changeset
|
70 let b:undo_ftplugin = "setl def< cms< com< " . |
1668 | 71 \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin |
72 | |
73 let &cpo = s:save_cpo | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
74 unlet s:save_cpo |
1668 | 75 |
76 " vim:set sw=2: |