Skip to content

Instantly share code, notes, and snippets.

@fuadnafiz98
Created March 29, 2021 17:05
Show Gist options
  • Save fuadnafiz98/6cb7a4dea53d441dce2faa4d8da89893 to your computer and use it in GitHub Desktop.
Save fuadnafiz98/6cb7a4dea53d441dce2faa4d8da89893 to your computer and use it in GitHub Desktop.
NerdTree alternative in 21 lines of code
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 = 20
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
noremap <silent> <C-b> :call ToggleNetrw()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment