parent
01278efa54
commit
3c3a835d8d
|
@ -420,17 +420,17 @@ function! s:open_buffer(entry)
|
||||||
if a:entry.type == 'special'
|
if a:entry.type == 'special'
|
||||||
execute a:entry.cmd
|
execute a:entry.cmd
|
||||||
elseif a:entry.type == 'session'
|
elseif a:entry.type == 'session'
|
||||||
execute a:entry.cmd a:entry.path
|
execute a:entry.cmd fnameescape(a:entry.path)
|
||||||
elseif a:entry.type == 'file'
|
elseif a:entry.type == 'file'
|
||||||
if line2byte('$') == -1
|
if line2byte('$') == -1
|
||||||
execute 'edit' a:entry.path
|
execute 'edit' fnameescape(a:entry.path)
|
||||||
else
|
else
|
||||||
if a:entry.cmd == 'tabnew'
|
if a:entry.cmd == 'tabnew'
|
||||||
wincmd =
|
wincmd =
|
||||||
endif
|
endif
|
||||||
execute a:entry.cmd a:entry.path
|
execute a:entry.cmd fnameescape(a:entry.path)
|
||||||
endif
|
endif
|
||||||
call s:check_user_options()
|
call s:check_user_options(a:entry.path)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -757,22 +757,15 @@ function! s:sort_by_tick(one, two)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:check_user_options {{{1
|
" Function: s:check_user_options {{{1
|
||||||
function! s:check_user_options() abort
|
function! s:check_user_options(path) abort
|
||||||
let path = expand('%')
|
let session = a:path . s:sep .'Session.vim'
|
||||||
let session = path . s:sep .'Session.vim'
|
|
||||||
|
|
||||||
" change to VCS root directory
|
|
||||||
if get(g:, 'startify_session_autoload') && filereadable(session)
|
if get(g:, 'startify_session_autoload') && filereadable(session)
|
||||||
execute 'source' session
|
execute 'source' session
|
||||||
elseif get(g:, 'startify_change_to_vcs_root')
|
elseif get(g:, 'startify_change_to_vcs_root')
|
||||||
call s:cd_to_vcs_root(path)
|
call s:cd_to_vcs_root(a:path)
|
||||||
" change directory
|
|
||||||
elseif get(g:, 'startify_change_to_dir', 1)
|
elseif get(g:, 'startify_change_to_dir', 1)
|
||||||
if isdirectory(path)
|
execute 'lcd' fnameescape(isdirectory(a:path) ? a:path : fnamemodify(a:path, ':h'))
|
||||||
lcd %
|
|
||||||
else
|
|
||||||
lcd %:p:h
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -782,7 +775,7 @@ function! s:cd_to_vcs_root(path) abort
|
||||||
for vcs in [ '.git', '.hg', '.bzr', '.svn' ]
|
for vcs in [ '.git', '.hg', '.bzr', '.svn' ]
|
||||||
let root = finddir(vcs, dir .';')
|
let root = finddir(vcs, dir .';')
|
||||||
if !empty(root)
|
if !empty(root)
|
||||||
execute 'cd '. fnamemodify(root, ':h')
|
execute 'cd '. fnameescape(fnamemodify(root, ':h'))
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
Loading…
Reference in a new issue