The netrw plugin normally ships with vim and is the default filebrowser. It gets a bad rap and ships with all kinds of features likes remote editing over SSH and FTP, and anecdotally has many bugs . Most developers just jump straight for the NERDtree plugin but in my opinion the default netrw plugin does most of what people use NERDtree for. Moreover, for opening files and traversing codebases there are other native vim options available.
Invoking netrw can be achieved in three ways
:Explore - opens netrw in the current window
:Sexplore - opens netrw in a horizontal split
:Vexplore - opens netrw in a horizontal split
You can also snigger by typing :Sex to invoke a horizontal split.
Changing the directory view in netrw
The directory listing view can be modified to show more or less information on files and directories, change the sorting order and hiding certain files.
With the directory browser open hit i to cycle through the view types. There are four different view types: thin, long, wide and tree. A preferred view type can be made permanent by setting it in a .vimrc file.
[code]let g:netrw_liststyle = 3[/code]
The tree list view in netrw.
Removing the banner
The directory banner is mostly useless. To remove it temporarily press I . To remove it permanently add the following to your .vimrc .
[code]let g:netrw_banner = 0[/code] Changing how files are opened
By default files will be opened in the same window as the netrw directory browser. To change this behaviour the netrw_browse_split option may be set. The options are as follows
1 - open files in a new horizontal split
2 - open files in a new vertical split
3 - open files in a new tab
To make the selection permanent add the following to your .vimrc .
[code]let g:netrw_browse_split = 1[/code] Set the width of the directory explorer
The width of the directory explorer can be fixed with the netrw_browse_split option. The following sets the width to 25% of the page.
[code]let g:netrw_winsize = 25[/code] NERDtree like setup
If NERDtree is your thing netrw can give you a similar experience with the following settings
[code]let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25
let g:netrw_banner = 0
autocmd VimEnter * :Vexplore