I've toggled netrw explorer window by adding the following commands found in an answer posted to this question to the vimrc file.
let g:NetrwIsOpen=0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
And I have autocmd calling ToggleNetrw()
with the following.
augroup ProjectDrawer
autocmd!
autocmd VimEnter * :call ToggleNetrw()
autocmd VimEnter * wincmd p
augroup END
But when a directory is opened in vim from the terminal (in my case: vim .
) it opens the directory in the editor window.
And When a file is selected and opened it is displayed the toggled explorer window.
Is there a way to make vim open directories in the toggled netrw window? Thanks for the help.
ToggleNetrw()
at Vim startup? Do you have an autocmd calling it?augroup ProjectDrawer autocmd! autocmd VimEnter * :call ToggleNetrw() autocmd VimEnter * wincmd p augroup END