parent
5fb1352ca0
commit
08c0164a1b
|
@ -381,7 +381,8 @@ 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)
|
||||
let oldfiles = call(get(g:, 'startify_enable_unsafe') ? 's:filter_oldfiles_unsafe' : 's:filter_oldfiles',
|
||||
\ [a:path_prefix, a:path_format])
|
||||
|
||||
if !empty(oldfiles)
|
||||
if exists('s:last_message')
|
||||
|
@ -418,10 +419,36 @@ function! s:filter_oldfiles(path_prefix, path_format) abort
|
|||
\ || !filereadable(absolute_path)
|
||||
\ || s:is_in_skiplist(absolute_path)
|
||||
\ || (exists('g:startify_bookmarks') && s:is_bookmark(absolute_path))
|
||||
\ || match(absolute_path, path_prefix)
|
||||
continue
|
||||
endif
|
||||
|
||||
if match(absolute_path, path_prefix)
|
||||
let entry_path = fnamemodify(absolute_path, a:path_format)
|
||||
let entries[absolute_path] = 1
|
||||
let counter -= 1
|
||||
let oldfiles += [[absolute_path, entry_path]]
|
||||
endfor
|
||||
|
||||
return oldfiles
|
||||
endfun
|
||||
|
||||
" Function: s:filter_oldfiles_unsafe {{{1
|
||||
function! s:filter_oldfiles_unsafe(path_prefix, path_format) abort
|
||||
let path_prefix = '\V'. escape(a:path_prefix, '\')
|
||||
let counter = s:numfiles
|
||||
let entries = {}
|
||||
let oldfiles = []
|
||||
|
||||
for fname in v:oldfiles
|
||||
if counter <= 0
|
||||
break
|
||||
endif
|
||||
|
||||
let absolute_path = glob(fnameescape(fnamemodify(fname, ":p")))
|
||||
if empty(absolute_path)
|
||||
\ || has_key(entries, absolute_path)
|
||||
\ || s:is_in_skiplist(absolute_path)
|
||||
\ || match(absolute_path, path_prefix)
|
||||
continue
|
||||
endif
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ default values.
|
|||
|g:startify_custom_indices|
|
||||
|g:startify_disable_at_vimenter|
|
||||
|g:startify_enable_special|
|
||||
|g:startify_enable_unsafe|
|
||||
|g:startify_files_number|
|
||||
|g:startify_list_order|
|
||||
|g:startify_relative_path|
|
||||
|
@ -278,6 +279,27 @@ Example:
|
|||
let g:startify_enable_special = 1
|
||||
<
|
||||
Show <empty buffer> and <quit>.
|
||||
------------------------------------------------------------------------------
|
||||
*g:startify_enable_unsafe*
|
||||
>
|
||||
let g:startify_enable_unsafe = 0
|
||||
<
|
||||
Enable the option only in case you think Vim starts too slowly (because of
|
||||
:Startify) or if you often edit files on remote filesystems.
|
||||
|
||||
It's called unsafe because it improves the time :Startify needs to execute by
|
||||
reducing the amount of syscalls to the underlying operating system, but
|
||||
sacrifices the precision of shown entries.
|
||||
|
||||
This could lead to inconsistences in the shown :Startify entries (e.g. the
|
||||
same file could be shown twice, because one time file was opened via absolute
|
||||
path and another time via symlink).
|
||||
|
||||
Currently this option does this:
|
||||
|
||||
- don't resolves symlinks (readlink(2))
|
||||
- don't check every file if it's readable (stat(2))
|
||||
- don't filter through the bookmark list
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:startify_session_savevars*
|
||||
|
|
Loading…
Reference in a new issue