Last active
May 31, 2017 05:55
-
-
Save rbtnn/7281389 to your computer and use it in GitHub Desktop.
簡易Filer
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
function! s:explorer(path) | |
if a:path ==# '.' | |
new | |
elseif isdirectory(a:path) | |
execute 'cd ' . a:path | |
else | |
execute 'tabedit ' . a:path | |
return | |
endif | |
let list = filter(glob('*', 1, 1) + glob('.*', 1, 1), 'v:val !~ "^\\.$"') | |
call map(list,'isdirectory(v:val) ? v:val . "/" : v:val ') | |
setf explorer | |
%delete _ | |
call setline(1,list) | |
nnoremap <buffer> <cr> :call <sid>explorer(getline('.'))<cr> | |
endfunction | |
call s:explorer('.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment