Просмотр исходного кода

New option: g:startify_update_oldfiles

References #192.
Marco Hinz 9 лет назад
Родитель
Сommit
de709a4dbe
2 измененных файлов с 16 добавлено и 3 удалено
  1. 11 0
      doc/startify.txt
  2. 5 3
      plugin/startify.vim

+ 11 - 0
doc/startify.txt

@@ -98,6 +98,7 @@ default values.
     |g:startify_list_order|
     |g:startify_relative_path|
     |g:startify_skiplist|
+    |g:startify_update_oldfiles|
 
     Misc options:~
     |g:startify_custom_footer|
@@ -200,6 +201,15 @@ Example:
 <
 The number of files to list.
 
+------------------------------------------------------------------------------
+                                                    *g:startify_update_oldfiles*
+>
+    let g:startify_update_oldfiles = 0
+<
+
+Usually |v:oldfiles| only gets updated when Vim exits. Using this option updates
+it on-the-fly, so that :Startify is always up-to-date.
+
 ------------------------------------------------------------------------------
                                                    *g:startify_session_autoload*
 >
@@ -805,6 +815,7 @@ This is my configuration..
     let g:startify_files_number           = 8
     let g:startify_relative_path          = 1
     let g:startify_change_to_dir          = 1
+    let g:startify_update_oldfiles        = 1
     let g:startify_session_autoload       = 1
     let g:startify_session_persistence    = 1
     let g:startify_session_delete_buffers = 1

+ 5 - 3
plugin/startify.vim

@@ -42,9 +42,11 @@ function! s:genesis()
       call startify#insane_in_the_membrane()
     endif
   endif
-  call map(v:oldfiles, 'fnamemodify(v:val, ":p")')
-  autocmd startify BufNewFile,BufRead,BufFilePre *
-        \ call s:update_oldfiles(expand('<afile>:p'))
+  if get(g:, 'startify_update_oldfiles')
+    call map(v:oldfiles, 'fnamemodify(v:val, ":p")')
+    autocmd startify BufNewFile,BufRead,BufFilePre *
+          \ call s:update_oldfiles(expand('<afile>:p'))
+  endif
   autocmd! startify VimEnter
 endfunction