From 22f1d583330f0e5b0006b054bd284a254ed332fb Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Wed, 26 Nov 2014 16:04:25 +0100 Subject: [PATCH] Fix last line #2 References #132. --- autoload/startify.vim | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index b031591..baddb7f 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -110,7 +110,7 @@ function! startify#insane_in_the_membrane() abort unlet item endfor - silent $-1,$delete _ + silent $delete _ if s:show_special call append('$', ['', ' [q] ']) @@ -372,16 +372,19 @@ endfunction " Function: s:display_by_path {{{1 function! s:display_by_path(path_prefix, path_format) abort let oldfiles = s:filter_oldfiles(a:path_prefix, a:path_format) + if !empty(oldfiles) if exists('s:last_message') call s:print_section_header() endif + for [absolute_path, entry_path] in oldfiles let index = s:get_index_as_string(s:entry_number) call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . entry_path) execute 'nnoremap ' index ':edit' escape(absolute_path, ' ') ' call check_user_options()' let s:entry_number += 1 endfor + call append('$', '') endif endfunction @@ -438,22 +441,26 @@ function! s:show_sessions() abort if exists('s:last_message') unlet s:last_message endif + return endif + if exists('s:last_message') call s:print_section_header() endif + for i in range(len(sfiles)) let index = s:get_index_as_string(s:entry_number) call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fnamemodify(sfiles[i], ':t')) execute 'nnoremap ' index ':SLoad' fnamemodify(sfiles[i], ':t') '' let s:entry_number += 1 endfor + call append('$', '') endfunction " Function: s:show_bookmarks {{{1 function! s:show_bookmarks() abort - if !exists('g:startify_bookmarks') + if !exists('g:startify_bookmarks') || empty(g:startify_bookmarks) return endif @@ -463,10 +470,8 @@ function! s:show_bookmarks() abort for fname in g:startify_bookmarks let index = s:get_index_as_string(s:entry_number) - call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname) execute 'nnoremap ' index ':edit' fnameescape(fname) ' call check_user_options()' - let s:entry_number += 1 endfor