Created
March 29, 2021 17:05
-
-
Save fuadnafiz98/6cb7a4dea53d441dce2faa4d8da89893 to your computer and use it in GitHub Desktop.
NerdTree alternative in 21 lines of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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