Skip to content

Instantly share code, notes, and snippets.

@nhooyr
Created March 6, 2016 06:29
Show Gist options
  • Save nhooyr/6888ef561c4c1c15bf46 to your computer and use it in GitHub Desktop.
Save nhooyr/6888ef561c4c1c15bf46 to your computer and use it in GitHub Desktop.
function! s:currentFilesList(ArgLead, CmdLine, CursorPos) abort
let l:head = expand('%:h')
let l:files = globpath(l:head, a:ArgLead.'*', 0, 1)
let l:head .='/'
for i in range(len(l:files))
if isdirectory(l:files[l:i])
let l:files[l:i] .= '/'
endif
let l:files[l:i] = substitute(l:files[l:i], l:head, '', '')
endfor
return l:files
endfunction
command! -bang -complete=customlist,s:currentFilesList -nargs=1 Ce execute 'edit<bang> '.fnameescape(expand('%:h')).'/'.<q-args>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment