Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gvim open dialog file type filter

I like using the file browser in gvim sometimes, however what I don't like is that the file filter is always set to the current file type being edited.

For example, if I have a .cpp file open in the current buffer and go to the file open dialog the file filter is set to "C++ source files (*.cpp *.c++)". I would prefer that headers are displayed too by default (say).

Is there a way to change this default behavior?

like image 545
ozbob Avatar asked Mar 26 '14 01:03

ozbob


2 Answers

Thanks to @benjifisher, I found the help for :browse which shows how to do what I wanted. More specifically, the default filetype plugin for C/C++ contains these lines:

let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
 \ "C Header Files (*.h)\t*.h\n" .
 \ "C Source Files (*.c)\t*.c\n" .
 \ "All Files (*.*)\t*.*\n"

I copied the file into my local vim ftplugin directory and modified to my liking which now takes precedence over the system version.

like image 117
ozbob Avatar answered Oct 31 '22 14:10

ozbob


If anyone, like me, wants a quick and simple way to disable this behaviour altogether in vimrc:

autocmd FileType * let b:browsefilter = '' 

From first reply in this thread

like image 24
Ozone Avatar answered Oct 31 '22 14:10

Ozone