I found the following chunk of command on this blog to have a file browser open by starting vim that I added to my .vimrc. It splits the window into 2 panes: a file browser and the text editor. The active pane is the file browser one. When quitting (from the text editor pane), we have to quit the editor and then the file browser pane

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
augroup ProjectDrawer
  autocmd VimEnter * :Vexplore
augroup END

What I would like to do have as behaviour is:

  1. To have the cursor on the text editor (and not on the file browser) when opening.
  2. When closing from the text editor, I want to quit vim altogether (and not having to close the text editor and then close the file browser pane): to have the text editor as "master"

Many thanks for your help!

  • 1
    You may want to read this article on project drawers
    – D. Ben Knoble
    Jul 5, 2020 at 12:34
  • 1
    For #2 you can quit vim with a single command even with multiple windows open using :qa or one of its variations (e.g. :wqa to write before quitting).
    – B Layer
    Jul 5, 2020 at 14:50

1 Answer 1


You can add a second VimScript command to be executed after :Vexplore. Here wincmd w is equivalent to the <Ctrl+w>w key combination which toggles windows (see Vim documentation: windows).

augroup ProjectDrawer
  autocmd VimEnter * :Vexplore | wincmd w
augroup END

See also this post: https://unix.stackexchange.com/questions/134759/running-a-vim-key-combination-on-startup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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