Skip to content

Instantly share code, notes, and snippets.

@hergaiety
Last active July 7, 2017 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hergaiety/abf5dac5fa12eb3824af60c134e747e9 to your computer and use it in GitHub Desktop.
Save hergaiety/abf5dac5fa12eb3824af60c134e747e9 to your computer and use it in GitHub Desktop.
let DirProjectHome = getcwd()
function! ExploreToggle(bang)
if &ft ==# "netrw"
:exe "lcd " . g:DirProjectHome
:bd
else
if a:bang
:lcd %:p:h
:enew
:Explore
else
:exe "lcd " . g:DirProjectHome
:enew
:Explore
endif
endif
endfunction
command! -bang ET call ExploreToggle(<bang>0)
" --- Commands ---
" :ET toggles file explorer from project home
" :ET! toggles file explorer from current open file's directory
" --- Suggested Mappings ---
" map ` :ET<CR>
" map ~ :ET!<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment