Changing to dir and VCS root is not mutually exclusive
If these two options are set.. g:startify_change_to_vcs_root (0 by default) g:startify_change_to_dir (1 by default) ..try changing to the VCS root first and, if that fails, to the directory of the current file afterwards. Fixes https://github.com/mhinz/vim-startify/issues/364
This commit is contained in:
parent
e4d35cc913
commit
c758d2a79a
|
@ -874,9 +874,14 @@ function! s:check_user_options(path) abort
|
||||||
execute 'silent bwipeout' a:path
|
execute 'silent bwipeout' a:path
|
||||||
call startify#session_delete_buffers()
|
call startify#session_delete_buffers()
|
||||||
execute 'source' session
|
execute 'source' session
|
||||||
elseif get(g:, 'startify_change_to_vcs_root')
|
return
|
||||||
call s:cd_to_vcs_root(a:path)
|
endif
|
||||||
elseif get(g:, 'startify_change_to_dir', 1)
|
|
||||||
|
if get(g:, 'startify_change_to_vcs_root') && s:cd_to_vcs_root(a:path)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get(g:, 'startify_change_to_dir', 1)
|
||||||
if isdirectory(a:path)
|
if isdirectory(a:path)
|
||||||
execute 'lcd' a:path
|
execute 'lcd' a:path
|
||||||
else
|
else
|
||||||
|
@ -897,9 +902,10 @@ function! s:cd_to_vcs_root(path) abort
|
||||||
let root = finddir(vcs, dir .';')
|
let root = finddir(vcs, dir .';')
|
||||||
if !empty(root)
|
if !empty(root)
|
||||||
execute 'cd '. fnameescape(fnamemodify(root, ':h'))
|
execute 'cd '. fnameescape(fnamemodify(root, ':h'))
|
||||||
return
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:close {{{1
|
" Function: s:close {{{1
|
||||||
|
|
Loading…
Reference in a new issue