views:

42

answers:

1

When I enter a folder in vim by pressing gf while over a path, I enter some kind of folder viewing mode.

I don't have for instance, line numbers set in it automatically.

How do i change the configuration for the folder viewing mode in Vim?

+4  A: 

If the path you're referencing is a directory, vim will use its builtin filebrowser.

thus:

doSeomthing(mypath = '/home/nate/superAwesome|Project/')

with | representing the cursor, if one uses "gf", this will produce the same results as:

:e /home/nate/superAwesomeProject/

or

:Explore

which will explore the directory of the path the current buffer is in.

There are a number of plugins available which show different views for directories (most notably perhaps, NERDTree), but the default file explorer is simply what it is. To my knowledge, there's no way to change this behavior, aside from mapping gf to another function or command.

for more information on the default file explorer, try :help :Explore, which shows the options of doing things like opening the explorer in a split, a new tab, seeing file information, etc.

sleepynate
Just for completeness, the filebrowser is provided by the netrw plugin. Running vim with --noplugin will show that this is not built in to vim.
Randy Morris
Oh right. Good point... it's technically a plugin that is usually loaded by default and comes with vim 7.2. Thanks Randy!
sleepynate