mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Merge pull request #1288 from SpaceVim/project_manager
Fix project manager
This commit is contained in:
commit
b1b8a354c3
@ -122,7 +122,7 @@ function! s:find_root_directory() abort
|
|||||||
else
|
else
|
||||||
let dir = SpaceVim#util#findFileInParent(pattern, fd)
|
let dir = SpaceVim#util#findFileInParent(pattern, fd)
|
||||||
endif
|
endif
|
||||||
if !empty(dir)
|
if !empty(dir) && isdirectory(dir)
|
||||||
let dir = fnamemodify(dir, ':p')
|
let dir = fnamemodify(dir, ':p')
|
||||||
call SpaceVim#logger#info("Find project root('" . pattern . "','" . fd . "'):" . dir)
|
call SpaceVim#logger#info("Find project root('" . pattern . "','" . fd . "'):" . dir)
|
||||||
call add(dirs, dir)
|
call add(dirs, dir)
|
||||||
@ -133,12 +133,11 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:sort_dirs(dirs) abort
|
function! s:sort_dirs(dirs) abort
|
||||||
let dirs = sort(a:dirs, funcref('s:compare'))
|
let dir = get(sort(a:dirs, funcref('s:compare')), 0, '')
|
||||||
let bufdir = getbufvar('%', 'rootDir', '')
|
let bufdir = getbufvar('%', 'rootDir', '')
|
||||||
if bufdir ==# get(dirs, 0, '')
|
if bufdir ==# dir
|
||||||
return ''
|
return ''
|
||||||
else
|
else
|
||||||
let dir = dirs[0]
|
|
||||||
if isdirectory(dir)
|
if isdirectory(dir)
|
||||||
let dir = fnamemodify(dir, ':p:h:h')
|
let dir = fnamemodify(dir, ':p:h:h')
|
||||||
else
|
else
|
||||||
@ -155,7 +154,7 @@ function! s:compare(d1, d2) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:change_to_root_directory() abort
|
function! s:change_to_root_directory() abort
|
||||||
if s:find_root_directory()
|
if !empty(s:find_root_directory())
|
||||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||||
endif
|
endif
|
||||||
return getbufvar('%', 'rootDir', '')
|
return getbufvar('%', 'rootDir', '')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user