1

In GVim running on Windows 10, when I open a file, the displayed files are limited to the suffix of the file currently being editted, e.g., "C Source Files (*.c)". I can change the pull down to "All Files (.)" but this is cumbersome.

In particular I edit Verilog (*.v) and System Verilog (*.sv). I'd like to skip the step where I have to select from the pull down to All Files. It's rather cumbersome.

The Mac version of GVim (mvim) shows all files and doesn't try to "help" you.

Any ideas?

[Edit] Thanks for the comments. Adding the following in _gvimrc works.
let b:browsefilter = "All files (.)\t*.*\n"

6
  • Welcome to Vi and Vim! Take a look at this question: vi.stackexchange.com/q/22905/18609. It's not on Windows, but it seems to match what you're seeing.
    – filbranden
    Aug 24 '20 at 0:26
  • 1
    try emptying the b:browsefilter variable Aug 24 '20 at 7:29
  • @Guddo Please post that as an answer, instead of an edit to your question... Thanks!
    – filbranden
    Sep 13 '20 at 23:14
  • Or maybe @ChristianBrabandt would like to post it as an answer, since his comment led to the solution of the problem...
    – filbranden
    Sep 13 '20 at 23:15
  • 1
    @filbranden okay, done Sep 14 '20 at 7:08
2

When using the graphical versions of the open dialog (e.g. using :browse :e command), vim will try to be clever and apply a filetype filter depending on your current filetype. So for a C file, it provides filter to only show C source files (*.c, *.cpp) , or header files (*.h) or a couple of other ones.

What Vim considers to be grouped together and shown to you in that dialog, can be customized by the browsefilter variable:

For MS Windows and GTK, you can modify the filters that are used in the browse dialog. By setting the g:browsefilter or b:browsefilter variables, you can change the filters globally or locally to the buffer. The variable is set to a string in the format "{filter label}\t{pattern};{pattern}\n" where {filter label} is the text that appears in the "Files of Type" comboBox, and {pattern} is the pattern which filters the filenames. Several patterns can be given, separated by ';'.

If you want to disable this behavior, you can just empty the buffer-local variable b:browsefilter:

:unlet! b:browsefilter

This could be done in an after-filetype plugin, e.g. for C filetype, add this line to a file called ~/.vim/after/ftplugin/c.vim (create non-existing directories). See e.g. :h ftplugin-overrule, if you only want this for very few specific filetypes. If you want to globally disable it, you could use e.g. an BufEnter autocommand (or similar ones).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.