Search code examples
vim

Go to back directory browsing after opening file in vim


When I open a directory browsing in vim, I can open a file by moving the cursor to a file name and pressing Enter.

Now, is there any command to go back to the previous directory browsing?

If not, is there a way to open a file without closing the directory browsing mode?


Solution

  • You can go back to the last buffer using :b#.

    If you just opened a file, then it will bring you just back to the directory browsing.

    Update: Since this answer happened to be accept as the correct answer and is thus on the top, I'd like to summarize a bit the answers, including the one by @romainl that imho is the correct one.