Wednesday, September 21, 2011

Re: how do I turn off file type matching in open file dialog?

Hi,

billy pilgrim wrote:
>
> When I am editing a C++ file, and use the open file dialog, it always
> defaults to looking for file types: C/C++. If I am looking for
> another file type (e.g., .h), I have to change it to All Files. This
> is not, of course, limited to C/C++ files, but that is a good
> example. I know there has to be a way to turn this off/on, right?
> Anyone know?

the open file dialog is called by executing

:browse {command}

where {command} is one of e, w, wall, wq, etc. If you have a look at

:help :browse

you will also find a section with help for a global variable called
browsefilter. You can also jump there directly with

:help browsefilter

Now that you know about it, you can check whether it is defined when you
edit C++ files and maybe where it has been defined. (For C++ it actually
has been set by the default C filetype plugin ($VIMRUNTIME/ftplugin/c.vim)).
The help also tells you that your own local filetype plugin is a good
place to set or override the global variable with a local variable
b:browsefilter (note the leading "b:"). So, with

:let b:browsefilter = ''

in your local $HOME/vimfiles/ftplugin/cpp.vim you can disable this
behavior for C++ files. If you want to disable it for all file types,
you can try it by putting

autocmd FileType * let b:browsefilter = ''

in your .vimrc.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

--
You received this message from the "vim_use" 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

No comments: