diff --git a/autoload/startify.vim b/autoload/startify.vim index 06f1d3d..9f00168 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -43,10 +43,38 @@ function! startify#insane_in_the_membrane() abort call append('$', ' [e] ') endif + if get(g:, 'startify_show_dir') + let files = [] + let numfiles = get(g:, 'startify_show_files_number', 10) + if special + call append('$', '') + endif + for fname in split(glob('.\=*')) + if (fname == '.') || (fname == '..') + continue + endif + call add(files, [getftime(fname), fname]) + endfor + function! l:compare(x, y) + return a:y[0] - a:x[0] + endfunction + call sort(files, 'l:compare') + for items in files + let index = s:get_index_as_string(cnt) + let fname = items[1] + call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) + execute 'nnoremap ' index ':edit' fnameescape(fname) '' + let cnt += 1 + if (cnt == numfiles) + break + endif + endfor + endif + if get(g:, 'startify_show_files', 1) && !empty(v:oldfiles) let entries = {} let numfiles = get(g:, 'startify_show_files_number', 10) - if special + if special || get(g:, 'startify_show_dir') call append('$', '') endif for fname in v:oldfiles @@ -61,9 +89,10 @@ function! startify#insane_in_the_membrane() abort let entries[expfname] = 1 let index = s:get_index_as_string(cnt) call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) - execute 'nnoremap '. index .' :edit '. fnameescape(fname) . s:cmd + execute 'nnoremap ' index ':edit' fnameescape(fname) s:cmd let cnt += 1 - if (cnt == numfiles) + let numfiles -= 1 + if !numfiles break endif endfor @@ -223,6 +252,7 @@ function! startify#get_separator() abort return !exists('+shellslash') || &shellslash ? '/' : '\' endfunction + " Function: s:is_in_skiplist {{{1 function! s:is_in_skiplist(arg) abort for regexp in g:startify_skiplist diff --git a/doc/startify.txt b/doc/startify.txt index cdc9a07..74cf64a 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -108,12 +108,23 @@ List saved sessions in g:startify_session_dir. List recently used files using viminfo. +The number is limited by g:startify_show_files_number. + ============- let g:startify_show_files_number = 10 -The amount of files to list. +The number of files to list. + + +============- + + let g:startify_show_dir = 0 + +Show files from the current directory sorted by modification time. + +The number is limited by g:startify_show_files_number. ============-