From 9102978c7be4b26e8f635b55e47c60589747a198 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Tue, 2 Sep 2014 17:07:15 +0200 Subject: [PATCH] Fix filenames with spaces - again #2 Vim automagically does some globbing, if a path to :edit contains special characters. Works: :edit /tmp/foo [bar] Doesn't work: :edit /tmp/foo bar This reverts 03de6ee but fixes the actual problem in another place by throwing escape(xxx, ' ') at the path. References #102. --- autoload/startify.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 46f0538..1cf5f4b 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -298,7 +298,7 @@ function! s:show_dir(cnt) abort let entries = {} let cwd = escape(getcwd(), '\') let files = filter(map(copy(v:oldfiles), - \ 'glob(fnamemodify(resolve(v:val), ":p"))'), 'match(v:val, cwd) == 0') + \ 'glob(fnameescape(fnamemodify(resolve(v:val), ":p")))'), 'match(v:val, cwd) == 0') if !empty(files) if exists('s:last_message') @@ -321,7 +321,7 @@ function! s:show_dir(cnt) abort let display_path = fnamemodify(abs_path, s:relative_path ? ':.' : ':p:~') call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . display_path) - execute 'nnoremap ' index ':edit' fnameescape(abs_path) ' call check_user_options()' + execute 'nnoremap ' index ':edit' escape(abs_path, ' ') ' call check_user_options()' let cnt += 1 let num -= 1 @@ -352,7 +352,7 @@ function! s:show_files(cnt) abort let entries = {} for fname in v:oldfiles - let abs_path = glob(fnamemodify(resolve(fname), ':p')) + let abs_path = glob(fnameescape(fnamemodify(resolve(fname), ':p'))) " filter duplicates, bookmarks and entries from the skiplist if has_key(entries, abs_path) @@ -367,7 +367,7 @@ function! s:show_files(cnt) abort let display_path = fnamemodify(abs_path, s:relative_path ? ':.' : ':p:~') call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . display_path) - execute 'nnoremap ' index ':edit' fnameescape(abs_path) ' call check_user_options()' + execute 'nnoremap ' index ':edit' escape(abs_path, ' ') ' call check_user_options()' let cnt += 1 let num -= 1