In gvim the command :browse confirm e
launches a GTK file browser. The default file mask in this window depends on the filetype from which the browse window is invoked. I would like to change that default file mask depending on the filetype. For example from .cpp
file the mask is *.cpp *.c++
and I want to add *.hpp *.ipp
there. From python file the mask is *.py
I would like it to be *
. And so on.
I use gvim version 8.1.141 on linux devuan beowulf.
(I could not find proper tags for this question, I tried to use tags: file browser, gtk, wildcard, glob, mask)
So far by grepping gvim sources I have found:
grep -E "\*\.cpp \*\.c++" . -r --color
./runtime/ftplugin/pyrex.vim: \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
./runtime/ftplugin/c.vim: let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
./runtime/ftplugin/c.vim: \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
So what is b:browsefilter
and how to use it?
The :h browsefilter
says that "You can override the filter setting on a per-buffer basis by setting the b:browsefilter variable.".
But I want to override it not per-buffer, but per-filetype from where the browse dialog was invoked.
gvim
. How else the browser would know which buffer inside gvim was active upon invocation? I am thinking about grepping gvim sources to find the variable name for that. Was hoping that someone knows it. OK, so far I got this:grep -E "\*\.cpp \*\.c\+\+" . -r --color
yields:./runtime/ftplugin/c.vim: let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n"
. So what isb:browsefilter
and how to use it ?:help browsefilter