Skip to content

Commit 7df207b

Browse files
committed
Guard against invalid filenames in filter_oldfiles_unsafe
Some plugins insert files into v:oldfiles with strange paths such as '[ Some message ]'. Startify errors on attempting to handle this path and creates a buggy vim startup experience.
1 parent 4e089df commit 7df207b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

autoload/startify.vim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,14 @@ function! s:filter_oldfiles_unsafe(path_prefix, path_format, use_env) abort
659659
continue
660660
endif
661661

662-
let absolute_path = glob(fnamemodify(fname, ":p"))
662+
663+
" some plugins insert files into v:oldfiles with strange paths such as
664+
" '[ Some message ]' and startify errors on attempting to handle them here.
665+
try
666+
let absolute_path = glob(fnamemodify(fname, ":p"))
667+
catch /^Vim\%((\a\+)\)\=:E944:/
668+
let absolute_path = ""
669+
endtry
663670
if empty(absolute_path)
664671
\ || has_key(entries, absolute_path)
665672
\ || (absolute_path =~ is_dir)

0 commit comments

Comments
 (0)