Skip to content

Instantly share code, notes, and snippets.

@rbtnn
Last active May 31, 2017 05:55
Show Gist options
  • Save rbtnn/7281389 to your computer and use it in GitHub Desktop.
Save rbtnn/7281389 to your computer and use it in GitHub Desktop.
簡易Filer
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