vim-startify
vim-startify copied to clipboard
how can I display Specify directory in the start screen
how can I display Specify directory
I want start screen can list all the file under directory /path/to/my/dir
Doesn't the built-in type dir
) suffice?
Else you could always add an Funcref type
and implement the method yourself like.
Something like:
let s:max_files_amount = 100
" List all files in current directory with optional amount
function! s:list_files_current_directory(...) abort
let l:file_amount = get(a:, 1, s:max_files_amount)
" Ensure boundries 0 < v <= max
if l:file_amount > s:max_files_amount
let l:file_amount = s:max_files_amount
elseif l:file_amount <= 0
let l:file_amount = 1
endif
let l:all_files = split(globpath('.', '*'), '\n')
return map(l:all_files[:l:file_amount-1], '{"line": v:val, "cmd": "edit " . v:val }')
endfunction
let g:startify_lists = [
\ { 'header': [' Most recently used files in current dir: '. getcwd()], 'type': 'dir' },
\ { 'header': [' All files in current directory'], 'type': function('s:list_files_current_directory', [20]) },
\ ]