I have an "almost" perfect netrw workflow. With my internet search, I:
- Splits Right/Bottom (without resize netrw);
- Toggle netrw (but has an issue);
In my workflow, I like to keep some directories expanded. It helps me a lot. But, when I toggle netrw, all exanded directories are closed and I have to open one by one. If I toggle again, it closes again.
There's a way to keep netrw tree expanded, even after toggle (like NERDTree)?
PS.: Now I'm using NERDTree, but, I would like to use less plugins... Vim already has a file explorer, then, I would like to use it.
Below my netrw setup:
let g:netrw_banner = 0 let g:netrw_liststyle = 3 let g:netrw_browse_split = 4 let g:netrw_winsize = 20 function! OpenToRight() :normal v let g:path=expand('%:p') :q! execute 'belowright vnew' g:path :normal <C-l> endfunction function! OpenBelow() :normal v let g:path=expand('%:p') :q! execute 'belowright new' g:path :normal <C-l> endfunction function! NetrwMappings() " Hack fix to make ctrl-l work properly noremap <buffer> <C-l> <C-w>l noremap <buffer> V :call OpenToRight()<CR> noremap <buffer> H :call OpenBelow()<CR> endfunction noremap <silent> <C-f> :call ToggleNetrw()<CR> augroup netrw_mappings autocmd! autocmd filetype netrw call NetrwMappings() augroup END " Allow for netrw to be toggled 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