From 7a2c7da36d1bd11342c49ac82ee88911382fcd69 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 28 Oct 2016 16:07:29 +0200 Subject: [PATCH] Unsafe: filter directories References #242. --- autoload/startify.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 39352ef..3685576 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -533,6 +533,7 @@ function! s:filter_oldfiles_unsafe(path_prefix, path_format, use_env) abort let counter = s:numfiles let entries = {} let oldfiles = [] + let is_dir = escape(s:sep, '\') . '$' for fname in v:oldfiles if counter <= 0 @@ -542,8 +543,9 @@ function! s:filter_oldfiles_unsafe(path_prefix, path_format, use_env) abort let absolute_path = glob(fnamemodify(fname, ":p")) if empty(absolute_path) \ || has_key(entries, absolute_path) - \ || s:is_in_skiplist(absolute_path) + \ || (absolute_path =~ is_dir) \ || match(absolute_path, path_prefix) + \ || s:is_in_skiplist(absolute_path) continue endif