Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using :Vexplore effectively

Tags:

vim

So, the :Vexplore command in vim opens a nice little directory browser to the left.

But how do I then open a file from that side-pane into the main window on the right?

One would assume there's a simple mapping for it, but I can't seem to find it.

like image 865
scribu Avatar asked Sep 09 '11 16:09

scribu


5 Answers

It turns out it's just a single line in .vimrc:

let g:netrw_browse_split=4      " Open file in previous buffer

Source: http://vimcasts.org/episodes/the-file-explorer/#comment-45366660

like image 187
scribu Avatar answered Nov 12 '22 22:11

scribu


I think you want o or P

Also, have a look at the documentation, e.g.

:he netrw-p11
like image 27
sehe Avatar answered Nov 12 '22 23:11

sehe


I'm sure what you're looking for is this:

:Vexplore!
like image 26
jpanganiban Avatar answered Nov 12 '22 22:11

jpanganiban


This is the same command you would use to navigate to different windows in Vim (like quickfix window, or different split), everything is explained in

:help windows.txt

But to answer to your question directly:

  • CTRLwCTRLh to move to the left window
  • CTRLwCTRLl to move to the right window

then Enter to select the file you want to open.

You might want to read :help netrw as well

like image 20
Xavier T. Avatar answered Nov 12 '22 23:11

Xavier T.


The latest netrw plugin (up to v153f) now provides the :Lexplore command, which opens an explorer on the right hand side of the vim display. It sets g:netrw_chgwin so edits occur in the window to the right of the netrw window. You can get it from http://www.drchip.org/astronaut/vim/index.html#NETRW .

like image 23
user21497 Avatar answered Nov 13 '22 00:11

user21497