New option: g:startify_session_sort

Sort your sessions by mtime by putting this in your vimrc:

    let g:startify_session_sort = 1

Closes #221.
This commit is contained in:
Marco Hinz 2016-06-01 17:23:56 +02:00
parent 54ee02272c
commit cee51f4a9a
2 changed files with 16 additions and 0 deletions

View file

@ -570,6 +570,13 @@ function! s:show_sessions() abort
call s:print_section_header()
endif
if get(g:, 'startify_session_sort')
function! s:sort_by_mtime(foo, bar)
return getftime(a:foo) <= getftime(a:bar)
endfunction
call sort(sfiles, 's:sort_by_mtime')
endif
for i in range(len(sfiles))
let index = s:get_index_as_string(s:entry_number)
let fname = fnamemodify(sfiles[i], ':t')

View file

@ -116,6 +116,7 @@ default values.
|g:startify_session_remove_lines|
|g:startify_session_savecmds|
|g:startify_session_savevars|
|g:startify_session_sort|
------------------------------------------------------------------------------
*g:startify_session_dir*
@ -412,6 +413,14 @@ Example:
\ 'silent !pdfreader ~/latexproject/main.pdf &'
\ ]
<
------------------------------------------------------------------------------
*g:startify_session_sort*
>
let g:startify_session_sort = 0
<
Sort sessions by modification time (when the session files were written)
rather than alphabetically.
------------------------------------------------------------------------------
*g:startify_custom_indices*
>