runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Commit: https://github.com/vim/vim/commit/93197fde0f1db09b1e495cf3eb14a8f42c318b80 Author: Doug Kearns <[email protected]> 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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]> diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 2ea6839c9..d0f893856 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 9.1. Last change: 2023 Sep 27 +*editing.txt* For Vim version 9.1. Last change: 2024 Jan 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1329,8 +1329,9 @@ b:browsefilter variable. You would most likely set b:browsefilter in a filetype plugin, so that the browse dialog would contain entries related to the type of file you are currently editing. Disadvantage: This makes it difficult to start editing a file of a different type. To overcome this, you -may want to add "All Files *.* " as the final filter, so that the user can -still access any desired file. +may want to add "All Files (*.*) * " as the final filter on Windows or "All +Files (*) * " on other platforms, so that the user can still access any +desired file. To avoid setting browsefilter when Vim does not actually support it, you can use has("browsefilter"): > diff --git a/runtime/ftplugin/aap.vim b/runtime/ftplugin/aap.vim index df839c99a..cd7e2a425 100644 --- a/runtime/ftplugin/aap.vim +++ b/runtime/ftplugin/aap.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Aap recipe " Maintainer: The Vim Project <https://github.com/vim/vim> -" Last Change: 2023 Aug 10 +" Last Change: 2024 Jan 14 " Former Maintainer: Bram Moolenaar <[email protected]> " Only do this when not done yet for this buffer @@ -28,6 +28,11 @@ setlocal commentstring=#\ %s setlocal expandtab if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Aap Recipe Files (*.aap) *.aap All Files (*.*) *.* " + let b:browsefilter = "Aap Recipe Files (*.aap) *.aap " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/abap.vim b/runtime/ftplugin/abap.vim index 61db8093f..8b2040e5a 100644 --- a/runtime/ftplugin/abap.vim +++ b/runtime/ftplugin/abap.vim @@ -3,7 +3,8 @@ " Author: Steven Oliver <[email protected]> " Copyright: Copyright (c) 2013 Steven Oliver " License: You may redistribute this under the same terms as Vim itself -" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin) +" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin) +" 2024 Jan 14 by Vim Project (browsefilter) " -------------------------------------------------------------------------- " Only do this when not done yet for this buffer @@ -21,10 +22,14 @@ setlocal suffixesadd=.abap let b:undo_ftplugin = "setl sts< sua< sw<" " Windows allows you to filter the open file dialog -if has("gui_win32") && !exists("b:browsefilter") - let b:browsefilter = "ABAP Source Files (*.abap) *.abap " . - \ "All Files (*.*) *.* " - let b:undo_ftplugin .= " | unlet! b:browsefilter" +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "ABAP Source Files (*.abap) *.abap " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif + let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim index 5931cd921..c16e7b032 100644 --- a/runtime/ftplugin/abaqus.vim +++ b/runtime/ftplugin/abaqus.vim @@ -2,6 +2,7 @@ " Language: Abaqus finite element input file (www.abaqus.com) " Maintainer: Carl Osterwisch <[email protected]> " Last Change: 2022 Oct 08 +" 2024 Jan 14 by Vim Project (browsefilter) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") | finish | endif @@ -49,8 +50,12 @@ endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Abaqus Input Files (*.inp *.inc) *.inp;*.inc " . \ "Abaqus Results (*.dat) *.dat " . - \ "Abaqus Messages (*.pre *.msg *.sta) *.pre;*.msg;*.sta " . - \ "All Files (*.*) *.* " + \ "Abaqus Messages (*.pre, *.msg, *.sta) *.pre;*.msg;*.sta " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif let b:undo_ftplugin .= "|unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/ant.vim b/runtime/ftplugin/ant.vim index aee07ca4b..65e01a1a7 100644 --- a/runtime/ftplugin/ant.vim +++ b/runtime/ftplugin/ant.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: ant +" Language: ant " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif @@ -15,8 +16,12 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "XML Files (*.xml) *.xml " . - \ "All Files (*.*) *.* " +let s:browsefilter = "XML Files (*.xml) *.xml " +if has("win32") + let s:browsefilter .= "All Files (*.*) * " +else + let s:browsefilter .= "All Files (*) * " +endif runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim let b:did_ftplugin = 1 @@ -30,7 +35,7 @@ if exists("b:browsefilter") endif " Change the :browse e filter to primarily show Ant-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Build Files (build.xml) build.xml " . \ "Java Files (*.java) *.java " . \ "Properties Files (*.prop*) *.prop* " . diff --git a/runtime/ftplugin/aspvbs.vim b/runtime/ftplugin/aspvbs.vim index 70a130d28..6979bb8f8 100644 --- a/runtime/ftplugin/aspvbs.vim +++ b/runtime/ftplugin/aspvbs.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: aspvbs +" Language: aspvbs " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif @@ -15,8 +16,12 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "HTML Files (*.html, *.htm) *.htm* " . - \ "All Files (*.*) *.* " +let s:browsefilter = "HTML Files (*.html, *.htm) *.htm* " +if has("win32") + let s:browsefilter .= "All Files (*.*) * " +else + let s:browsefilter .= "All Files (*) * " +endif let s:match_words = "" runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim @@ -51,7 +56,7 @@ if exists("loaded_matchit") endif " Change the :browse e filter to primarily show ASP-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="ASP Files (*.asp) *.asp " . s:browsefilter endif diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim index 40fe304cf..bcd772350 100644 --- a/runtime/ftplugin/awk.vim +++ b/runtime/ftplugin/awk.vim @@ -2,7 +2,7 @@ " Language: awk, nawk, gawk, mawk " Maintainer: Doug Kearns <[email protected]> " Previous Maintainer: Antonio Colombo <[email protected]> -" Last Change: 2020 Sep 28 +" Last Change: 2024 Jan 14 " This plugin was prepared by Mark Sikora " This plugin was updated as proposed by Doug Kearns @@ -25,8 +25,7 @@ setlocal formatoptions-=t formatoptions+=croql setlocal define=function setlocal suffixesadd+=.awk -let b:undo_ftplugin = "setl fo< com< cms< def< sua<" . - \ " | unlet! b:browsefilter" +let b:undo_ftplugin = "setl fo< com< cms< def< sua<" " TODO: set this in scripts.vim? if exists("g:awk_is_gawk") @@ -49,8 +48,13 @@ if exists("g:awk_is_gawk") endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Awk Source Files (*.awk,*.gawk) *.awk;*.gawk " . - \ "All Files (*.*) *.* " + let b:browsefilter = "Awk Source Files (*.awk, *.gawk) *.awk;*.gawk " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif + let b:undo_ftplugin .= " | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/basic.vim b/runtime/ftplugin/basic.vim index 4399fbf3a..32f713b43 100644 --- a/runtime/ftplugin/basic.vim +++ b/runtime/ftplugin/basic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: BASIC (QuickBASIC 4.5) " Maintainer: Doug Kearns <[email protected]> -" Last Change: 2022 Jun 22 +" Last Change: 2024 Jan 14 if exists("b:did_ftplugin") finish @@ -45,8 +45,12 @@ endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "BASIC Source Files (*.bas) *.bas " .. - \ "BASIC Include Files (*.bi, *.bm) *.bi;*.bm " .. - \ "All Files (*.*) *.* " + \ "BASIC Include Files (*.bi, *.bm) *.bi;*.bm " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif let b:basic_set_browsefilter = 1 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter" endif diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index 4ddc4a539..e2eebc549 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: C " Maintainer: The Vim Project <https://github.com/vim/vim> -" Last Change: 2023 Aug 10 +" Last Change: 2023 Aug 22 " Former Maintainer: Bram Moolenaar <[email protected]> " Only do this when not done yet for this buffer @@ -48,24 +48,26 @@ if !exists("b:match_words") let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words" endif -" Win32 can filter files in the browse dialog +" Win32 and GTK can filter files in the browse dialog if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") if &ft == "cpp" - let b:browsefilter = "C++ Source Files (*.cpp *.c++) *.cpp;*.c++ " . - \ "C Header Files (*.h) *.h " . - \ "C Source Files (*.c) *.c " . - \ "All Files (*.*) *.* " + let b:browsefilter = "C++ Source Files (*.cpp, *.c++) *.cpp;*.c++ " .. + \ "C Header Files (*.h) *.h " .. + \ "C Source Files (*.c) *.c " elseif &ft == "ch" - let b:browsefilter = "Ch Source Files (*.ch *.chf) *.ch;*.chf " . - \ "C Header Files (*.h) *.h " . - \ "C Source Files (*.c) *.c " . - \ "All Files (*.*) *.* " + let b:browsefilter = "Ch Source Files (*.ch, *.chf) *.ch;*.chf " .. + \ "C Header Files (*.h) *.h " .. + \ "C Source Files (*.c) *.c " else - let b:browsefilter = "C Source Files (*.c) *.c " . - \ "C Header Files (*.h) *.h " . - \ "Ch Source Files (*.ch *.chf) *.ch;*.chf " . - \ "C++ Source Files (*.cpp *.c++) *.cpp;*.c++ " . - \ "All Files (*.*) *.* " + let b:browsefilter = "C Source Files (*.c) *.c " .. + \ "C Header Files (*.h) *.h " .. + \ "Ch Source Files (*.ch, *.chf) *.ch;*.chf " .. + \ "C++ Source Files (*.cpp, *.c++) *.cpp;*.c++ " + endif + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/clojure.vim b/runtime/ftplugin/clojure.vim index c922d7569..4da7554d8 100644 --- a/runtime/ftplugin/clojure.vim +++ b/runtime/ftplugin/clojure.vim @@ -6,6 +6,7 @@ " URL: https://github.com/clojure-vim/clojure.vim " License: Vim (see :h license) " Last Change: 2022-03-24 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") finish @@ -66,10 +67,14 @@ endif " Filter files in the browse dialog if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "All Files * " . - \ "Clojure Files *.clj;*.cljc;*.cljs;*.cljx " . + let b:browsefilter = "Clojure Files *.clj;*.cljc;*.cljs;*.cljx " . \ "EDN Files *.edn " . \ "Java Files *.java " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif let b:undo_ftplugin .= ' | unlet! b:browsefilter' endif diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim index ec1e95456..5e52702fd 100644 --- a/runtime/ftplugin/cobol.vim +++ b/runtime/ftplugin/cobol.vim @@ -3,6 +3,7 @@ " Maintainer: Ankit Jain <[email protected]> " (formerly Tim Pope <[email protected]>) " Last Update: By Ankit Jain (add gtk support) on 15.08.2020 +" 2024 Jan 14 by Vim Project (browsefilter) " Insert mode mappings: <C-T> <C-D> <Tab> " Normal mode mappings: < > << >> [[ ]] [] ][ @@ -39,8 +40,12 @@ endif " add gtk support if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "COBOL Source Files (*.cbl, *.cob) *.cbl;*.cob;*.lib ". - \ "All Files (*.*) *.* " + let b:browsefilter = "COBOL Source Files (*.cbl, *.cob) *.cbl;*.cob;*.lib " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif endif let b:undo_ftplugin = "setlocal com< cms< fo< et< tw<" . diff --git a/runtime/ftplugin/config.vim b/runtime/ftplugin/config.vim index 73136cbc6..595fc657b 100644 --- a/runtime/ftplugin/config.vim +++ b/runtime/ftplugin/config.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: config +" Language: config " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif @@ -15,8 +16,12 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "Bourne Shell Files (*.sh) *.sh " . - \ "All Files (*.*) *.* " +let s:browsefilter = "Bourne Shell Files (*.sh) *.sh " +if has("win32") + let s:browsefilter .= "All Files (*.*) * " +else + let s:browsefilter .= "All Files (*) * " +endif let s:match_words = "" runtime! ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.vim @@ -31,7 +36,7 @@ if exists("b:browsefilter") endif " Change the :browse e filter to primarily show configure-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="Configure Scripts (configure.*, config.*) configure*;config.* " . \ s:browsefilter endif diff --git a/runtime/ftplugin/cs.vim b/runtime/ftplugin/cs.vim index 0734d11d2..ada71315e 100644 --- a/runtime/ftplugin/cs.vim +++ b/runtime/ftplugin/cs.vim @@ -3,6 +3,7 @@ " Maintainer: Nick Jensen <[email protected]> " Former Maintainer: Johannes Zellner <[email protected]> " Last Change: 2022-11-16 +" 2024 Jan 14 by Vim Project (browsefilter) " License: Vim (see :h license) " Repository: https://github.com/nickspoons/vim-cs @@ -31,10 +32,14 @@ if exists('loaded_matchit') && !exists('b:match_words') endif if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter') - let b:browsefilter = "C# Source Files (*.cs *.csx) *.cs;*.csx " . + let b:browsefilter = "C# Source Files (*.cs, *.csx) *.cs;*.csx " . \ "C# Project Files (*.csproj) *.csproj " . - \ "Visual Studio Solution Files (*.sln) *.sln " . - \ "All Files (*.*) *.* " + \ "Visual Studio Solution Files (*.sln) *.sln " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif let b:undo_ftplugin .= ' | unlet! b:browsefilter' endif diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim index 2feec57bb..a22bee327 100644 --- a/runtime/ftplugin/csh.vim +++ b/runtime/ftplugin/csh.vim @@ -3,7 +3,7 @@ " Maintainer: Doug Kearns <[email protected]> " Previous Maintainer: Dan Sharp " Contributor: Johannes Zellner <[email protected]> -" Last Change: 2023 Oct 09 +" Last Change: 2024 Jan 14 if exists("b:did_ftplugin") finish @@ -44,8 +44,12 @@ if exists("loaded_matchit") && !exists("b:match_words") endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "csh Scripts (*.csh) *.csh " .. - \ "All Files (*.*) *.* " + let b:browsefilter = "csh Scripts (*.csh) *.csh " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif let b:csh_set_browsefilter = 1 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:csh_set_browsefilter" endif diff --git a/runtime/ftplugin/diff.vim b/runtime/ftplugin/diff.vim index f2a0820be..2daa48aeb 100644 --- a/runtime/ftplugin/diff.vim +++ b/runtime/ftplugin/diff.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Diff " Maintainer: The Vim Project <https://github.com/vim/vim> -" Last Change: 2023 Aug 10 +" Last Change: 2023 Aug 22 " Former Maintainer: Bram Moolenaar <[email protected]> " Only do this when not done yet for this buffer @@ -19,6 +19,11 @@ setlocal nomodeline let &l:commentstring = "# %s" if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Diff Files (*.diff) *.diff Patch Files (*.patch) *.h All Files (*.*) *.* " + let b:browsefilter = "Diff Files (*.diff) *.diff Patch Files (*.patch) *.h " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim index f02f26b1f..5001cf68b 100644 --- a/runtime/ftplugin/dosbatch.vim +++ b/runtime/ftplugin/dosbatch.vim @@ -2,6 +2,7 @@ " Language: MS-DOS/Windows .bat files " Maintainer: Mike Williams <[email protected]> " Last Change: 12th February 2023 +" 2024 Jan 14 by Vim Project (browsefilter) " " Options Flags: " dosbatch_colons_comment - any value to treat :: as comment line @@ -37,12 +38,17 @@ if executable('help.exe') endif " Define patterns for the browse file filter -if has("gui_win32") && !exists("b:browsefilter") - let b:browsefilter = "DOS Batch Files (*.bat, *.cmd) *.bat;*.cmd All Files (*.*) *.* " +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "DOS Batch Files (*.bat, *.cmd) *.bat;*.cmd " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif endif let b:undo_ftplugin = "setlocal comments< formatoptions< keywordprg<" - \ . "| unlet! b:browsefiler" + \ . "| unlet! b:browsefilter" let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim index a046118c7..bea8c5c18 100644 --- a/runtime/ftplugin/dtd.vim +++ b/runtime/ftplugin/dtd.vim @@ -1,10 +1,11 @@ " Vim filetype plugin file -" Language: dtd +" Language: dtd " " This runtime file is looking for a new maintainer. " " Former maintainer: Dan Sharp -" Last Changed: 20 Jan 2009 +" Last Change: 2009 Jan 20 +" 2024 Jan 14 by Vim Project (browsefilter) if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -27,10 +28,14 @@ if exists("loaded_matchit") endif " Change the :browse e filter to primarily show Java-related files. -if has("gui_win32") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="DTD Files (*.dtd) *.dtd " . - \ "XML Files (*.xml) *.xml " . - \ "All Files (*.*) *.* " + \ "XML Files (*.xml) *.xml " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif endif " Undo the stuff we changed. diff --git a/runtime/ftplugin/eiffel.vim b/runtime/ftplugin/eiffel.vim index 216fdde16..e193110cd 100644 --- a/runtime/ftplugin/eiffel.vim +++ b/runtime/ftplugin/eiffel.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Eiffel " Maintainer: Doug Kearns <[email protected]> -" Last Change: 2010 Aug 29 +" Last Change: 2024 Jan 14 if (exists("b:did_ftplugin")) finish @@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Eiffel Source Files (*.e) *.e " . - \ "Eiffel Control Files (*.ecf, *.ace, *.xace) *.ecf;*.ace;*.xace " . - \ "All Files (*.*) *.* " + \ "Eiffel Control Files (*.ecf, *.ace, *.xace) *.ecf;*.ace;*.xace " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif endif if exists("loaded_matchit") && !exists("b:match_words") diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index 893fa58d3..b5c4665d2 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -4,6 +4,7 @@ " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <[email protected]> " Last Change: 2022 May 15 +" 2024 Jan 14 by Vim Project (browsefilter) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -15,7 +16,11 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "All Files (*.*) *.* " +if has("win32") + let s:browsefilter = "All Files (*.*) * " +else + let s:browsefilter = "All Files (*) * " +endif let s:match_words = "" if !exists("g:eruby_default_subtype") @@ -109,8 +114,8 @@ exe 'cmap <buffer><script><expr> <Plug><cfile> ErubyAtCursor() ? ' . maparg('<Pl exe 'cmap <buffer><script><expr> <Plug><ctag> ErubyAtCursor() ? ' . maparg('<Plug><ctag>', 'c') . ' : ' . get(s:ctagmap, 'rhs', '" "') unlet s:cfilemap s:ctagmap s:include s:path s:suffixesadd -" Change the browse dialog on Win32 to show mainly eRuby-related files -if has("gui_win32") +" Change the browse dialog on Win32 and GTK to show mainly eRuby-related files +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter="eRuby Files (*.erb, *.rhtml) *.erb;*.rhtml " . s:browsefilter endif diff --git a/runtime/ftplugin/expect.vim b/runtime/ftplugin/expect.vim index a4c6af96c..b4db15499 100644 --- a/runtime/ftplugin/expect.vim +++ b/runtime/ftplugin/expect.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Expect " Maintainer: Doug Kearns <[email protected]> -" Last Change: 2022 Jul 16 +" Last Change: 2024 Jan 14 if exists("b:did_ftplugin") finish @@ -14,8 +14,12 @@ let s:cpo_save = &cpo set cpo&vim if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Expect Command Files (*.exp) *.exp " .. - \ "All Files (*.*) *.* " + let b:browsefilter = "Expect Command Files (*.exp) *.exp " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/falcon.vim b/runtime/ftplugin/falcon.vim index affca3848..1000b62e7 100644 --- a/runtime/ftplugin/falcon.vim +++ b/runtime/ftplugin/falcon.vim @@ -4,6 +4,7 @@ " Copyright: Copyright (c) 2009-2013 Steven Oliver " License: You may redistribute this under the same terms as Vim itself " Last Update: 2020 Oct 10 +" 2024 Jan 14 by Vim Project (browsefilter) " -------------------------------------------------------------------------- " Only do this when not done yet for this buffer @@ -34,14 +35,18 @@ endif setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// " Windows allows you to filter the open file dialog -if has("gui_win32") && !exists("b:browsefilter") - let b:browsefilter = "Falcon Source Files (*.fal *.ftd) *.fal;*.ftd " . - \ "All Files (*.*) *.* " +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Falcon Source Files (*.fal, *.ftd) *.fal;*.ftd " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif endif let b:undo_ftplugin = "setlocal tabstop< shiftwidth< expandtab< fileencoding<" \ . " suffixesadd< comments<" - \ . "| unlet! b:browsefiler" + \ . "| unlet! b:browsefilter" let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/forth.vim b/runtime/ftplugin/forth.vim index d28c8484e..df4694f20 100644 --- a/runtime/ftplugin/forth.vim +++ b/runtime/ftplugin/forth.vim @@ -2,6 +2,7 @@ " Language: Forth " Maintainer: Johan Kotlinski <[email protected]> " Last Change: 2023 Sep 15 +" 2024 Jan 14 by Vim Project (browsefilter) " URL: https://github.com/jkotlinski/forth.vim if exists("b:did_ftplugin") @@ -62,8 +63,12 @@ if exists("loaded_matchit") && !exists("b:match_words") endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Forth Source Files (*.f *.fs *.ft *.fth *.4th) *.f;*.fs;*.ft;*.fth;*.4th " .. - \ "All Files (*.*) *.* " + let b:browsefilter = "Forth Source Files (*.f, *.fs, *.ft, *.fth, *.4th) *.f;*.fs;*.ft;*.fth;*.4th " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim index d714a4ac4..3c325818d 100644 --- a/runtime/ftplugin/fortran.vim +++ b/runtime/ftplugin/fortran.vim @@ -9,6 +9,8 @@ " Since then, useful suggestions and contributions have been made, in order, by: " Stefano Zacchiroli, Hendrik Merx, Ben Fritz, David Barnett, Eisuke Kawashima, " Doug Kearns, and Fritz Reese. +" Last Change: 2023 Dec 22 +" 2024 Jan 14 by Vim Project (browsefilter) " Only do these settings when not done yet for this buffer if exists("b:did_ftplugin") @@ -135,8 +137,12 @@ endif " File filters for :browse e if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Fortran Files (*.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn) *.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn " . - \ "All Files (*.*) *.* " + let b:browsefilter = "Fortran Files (*.f, *.for, *.f77, *.f90, *.f95, *.f03, *.f08, *.fpp, *.ftn) *.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn " + if has("win32") + let b:browsefilter .= "All Files (*.*) * " + else + let b:browsefilter .= "All Files (*) * " + endif endif let b:undo_ftplugin = "setl fo< com< tw< cms< et< inc< sua<" diff --git a/runtime/ftplugin/fpcmake.vim b/runtime/ftplugin/fpcmake.vim index 8d950838c..e365ba780 100644 --- a/runtime/ftplugin/fpcmake.vim +++ b/runtime/ftplugin/fpcmake.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Free Pascal Makefile Generator " Maintainer: Doug Kearns <[email protected]> -" Last Change: 2021 Apr 23 +" Last Change: 2024 Jan 14 if exists("b:did_ftplugin") finish @@ -13,11 +13,15 @@ set cpo&vim runtime! ftplugin/make.vim if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Free Pascal Makefile Definition Files (*.fpc) *.fpc " .. - \ "All Files (*.*) *.* " + let b:browsefilter = "Free Pascal Makefile Definition Files (*.fpc) *.fpc " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif + let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif -let b:undo_ftplugin = b:undo_ftplugin .. " | unlet! b:browsefilter" let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/freebasic.vim b/runtime/ftplugin/freebasic.vim index 1680e84c9..8eadb44c2 100644 --- a/runtime/ftplugin/freebasic.vim +++ b/runtime/ftplugin/freebasic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: FreeBASIC " Maintainer: Doug Kearns <[email protected]> -" Last Change: 2022 Jun 24 +" Last Change: 2023 Aug 22 " Setup {{{1 if exists("b:did_ftplugin") @@ -70,8 +70,12 @@ endif if (has("gui_win32") || has("gui_gtk")) && exists("b:basic_set_browsefilter") let b:browsefilter = "FreeBASIC Source Files (*.bas) *.bas " .. - \ "FreeBASIC Header Files (*.bi) *.bi " .. - \ "All Files (*.*) *.* " + \ "FreeBASIC Header Files (*.bi) *.bi " + if has("win32") + let b:browsefilter ..= "All Files (*.*) * " + else + let b:browsefilter ..= "All Files (*) * " + endif endif " Cleanup {{{1 diff --git a/runtime/ftplugin/haml.vim b/runtime/ftplugin/haml.vim index 6f3016995..910d9c78b 100644 --- a/runtime/ftplugin/haml.vim +++ b/runtime/ftplugin/haml.vim @@ -2,6 +2,7 @@ " Language: Haml " Maintainer: Tim Pope <[email protected]> " Last Change: 2019 Dec 05 +" 2024 Jan 14 by Vim Project (browsefilter) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -13,7 +14,11 @@ set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "All Files (*.*) *.* " +if has("win32") + let s:browsefilter = "All Files (*.*) * " +else + let s:browsefilter = "All Files (*) * " +endif let s:match_words = "" runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim @@ -44,14 +49,14 @@ if exists("b:undo_ftplugin") let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin endif if exists ("b:browsefilter") - let s:browsefilter = substitute(b:browsefilter,' -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1rP6sp-00CH1o-Fw%40256bit.org.
