4

When using VIM, it is possible to get a file listing in one split window by doing this:

:vsp
:e.

Then you have something that looks like this:

enter image description here

However if you open a file then how can you get back to the listing? Normally when you open a file in vim then you write :wq for writing change and then exit, however if you do this in this case, then the split window is closed.

Is it possible to exit the file and return to previous listing setup? If so , how could it be done?

  • :args returns the opened file name. If we could get that, then we can get back to the file we opened. – SibiCoder Aug 22 '16 at 8:22
5

There is a dedicated command for opening a netrw listing in a vertical split:

:Vex[plore]

There is a dedicated command for going back to the latest netrw listing:

:Rex[plore]

Netrw comes with a complete documentation; read it: :help netrw.

  • Thanks - so you mean use :Vexplore to show listings instead of :e. and then press 'o' instead of <cr> to open and view file, then a new window will open and when :q - quit is used the new window closes – serup Aug 22 '16 at 8:44
0

You can also use :Lexplore to get a vertically split window containing a directory listing with netrw, and use :Rexplore to return from that or any netrw listing back to the file.

-1

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 vertical split

You can also snigger by typing :Sex to invoke a horizontal split.

For more Information check it here: https://shapeshed.com/vim-netrw/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.