Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move filename escaping to just before execution #546

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions autoload/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,12 @@ function! s:open_buffer(entry)
execute a:entry.cmd a:entry.path
elseif a:entry.type == 'file'
if line2byte('$') == -1
execute 'edit' a:entry.path
execute 'edit' fnameescape(a:entry.path)
else
if a:entry.cmd == 'tabnew'
wincmd =
endif
execute a:entry.cmd a:entry.path
execute a:entry.cmd fnameescape(a:entry.path)
endif
call s:check_user_options(a:entry.path)
endif
Expand Down Expand Up @@ -770,7 +770,7 @@ function! s:show_bookmarks() abort
if has('win32')
let path = substitute(path, '\[', '\[[]', 'g')
endif
call s:register(line('$'), index, 'file', 'edit', fnameescape(expand(path)))
call s:register(line('$'), index, 'file', 'edit', expand(path))

unlet bookmark " avoid type mismatch for heterogeneous lists
endfor
Expand Down Expand Up @@ -968,11 +968,13 @@ function! s:check_user_options(path) abort

if get(g:, 'startify_change_to_dir', 1)
if isdirectory(a:path)
execute s:cd_cmd() a:path
echom 'path is a dir: ' .. s:cd_cmd() .. ' ' .. a:path
execute s:cd_cmd() fnameescape(a:path)
else
echom 'path is not a dir: ' .. s:cd_cmd() .. ' ' .. a:path
let dir = fnamemodify(a:path, ':h')
if isdirectory(dir)
execute s:cd_cmd() dir
execute s:cd_cmd() fnameescape(dir)
else
" Do nothing. E.g. a:path == `scp://foo/bar`
endif
Expand Down