comparison 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
comparison
equal deleted inserted replaced
34133:c6737e875c4a 34134:8ae680be2a51
1 " Vim filetype plugin 1 " Vim filetype plugin
2 " Language: Haml 2 " Language: Haml
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4 " Last Change: 2019 Dec 05 4 " Last Change: 2019 Dec 05
5 " 2024 Jan 14 by Vim Project (browsefilter)
5 6
6 " Only do this when not done yet for this buffer 7 " Only do this when not done yet for this buffer
7 if exists("b:did_ftplugin") 8 if exists("b:did_ftplugin")
8 finish 9 finish
9 endif 10 endif
11 let s:save_cpo = &cpo 12 let s:save_cpo = &cpo
12 set cpo-=C 13 set cpo-=C
13 14
14 " Define some defaults in case the included ftplugins don't set them. 15 " Define some defaults in case the included ftplugins don't set them.
15 let s:undo_ftplugin = "" 16 let s:undo_ftplugin = ""
16 let s:browsefilter = "All Files (*.*)\t*.*\n" 17 if has("win32")
18 let s:browsefilter = "All Files (*.*)\t*\n"
19 else
20 let s:browsefilter = "All Files (*)\t*\n"
21 endif
17 let s:match_words = "" 22 let s:match_words = ""
18 23
19 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim 24 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
20 unlet! b:did_ftplugin 25 unlet! b:did_ftplugin
21 set matchpairs-=<:> 26 set matchpairs-=<:>
42 " Combine the new set of values with those previously included. 47 " Combine the new set of values with those previously included.
43 if exists("b:undo_ftplugin") 48 if exists("b:undo_ftplugin")
44 let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin 49 let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
45 endif 50 endif
46 if exists ("b:browsefilter") 51 if exists ("b:browsefilter")
47 let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter 52 let s:browsefilter = substitute(b:browsefilter,'\cAll Files (.*)\t\*\n','','') . s:browsefilter
48 endif 53 endif
49 if exists("b:match_words") 54 if exists("b:match_words")
50 let s:match_words = b:match_words . ',' . s:match_words 55 let s:match_words = b:match_words . ',' . s:match_words
51 endif 56 endif
52 57
53 " Change the browse dialog on Win32 to show mainly Haml-related files 58 " Change the browse dialog on Win32 and GTK to show mainly Haml-related files
54 if has("gui_win32") 59 if has("gui_win32") || has("gui_gtk")
55 let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter 60 let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter
56 endif 61 endif
57 62
58 " Load the combined list of match_words for matchit.vim 63 " Load the combined list of match_words for matchit.vim
59 if exists("loaded_matchit") 64 if exists("loaded_matchit")
60 let b:match_words = s:match_words 65 let b:match_words = s:match_words
61 endif 66 endif
62 67
63 setlocal comments= commentstring=-#\ %s 68 setlocal comments= commentstring=-#\ %s
64 69
65 let b:undo_ftplugin = "setl def< cms< com< " 70 let b:undo_ftplugin = "setl def< cms< com< " .
66 \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin 71 \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
67 72
68 let &cpo = s:save_cpo 73 let &cpo = s:save_cpo
69 unlet s:save_cpo 74 unlet s:save_cpo
70 75