1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 12:50:05 +08:00

disable autochange dir - fix option

This commit is contained in:
Sarunas Valaskevicius 2018-12-19 15:59:41 +00:00
parent 5a5cd8280b
commit ee7e5b6af1
2 changed files with 32 additions and 36 deletions

View File

@ -915,7 +915,6 @@ function! SpaceVim#begin() abort
augroup END augroup END
else else
call SpaceVim#logger#info('Startup with argv: ' . string(s:status[1]) ) call SpaceVim#logger#info('Startup with argv: ' . string(s:status[1]) )
call SpaceVim#plugins#projectmanager#current_root()
endif endif
call SpaceVim#default#options() call SpaceVim#default#options()
call SpaceVim#default#layers() call SpaceVim#default#layers()

View File

@ -81,8 +81,14 @@ endfunction
function! SpaceVim#plugins#projectmanager#current_root() abort function! SpaceVim#plugins#projectmanager#current_root() abort
let rootdir = getbufvar('%', 'rootDir', '') let rootdir = getbufvar('%', 'rootDir', '')
if empty(rootdir) if empty(rootdir)
let rootdir = s:change_to_root_directory() let rootdir = s:find_root_directory()
else if empty(rootdir)
let rootdir = getcwd()
endif
call setbufvar('%', 'rootDir', rootdir)
endif
if !empty(rootdir) && g:spacevim_project_rooter_automatically
echo g:spacevim_project_rooter_automatically
call s:change_dir(rootdir) call s:change_dir(rootdir)
call SpaceVim#plugins#projectmanager#RootchandgeCallback() call SpaceVim#plugins#projectmanager#RootchandgeCallback()
endif endif
@ -160,9 +166,7 @@ function! s:sort_dirs(dirs) abort
else else
let dir = fnamemodify(dir, ':p:h') let dir = fnamemodify(dir, ':p:h')
endif endif
call s:change_dir(dir) return dir
call setbufvar('%', 'rootDir', getcwd())
return b:rootDir
endif endif
endfunction endfunction
@ -170,12 +174,5 @@ function! s:compare(d1, d2) abort
return len(split(a:d2, '/')) - len(split(a:d1, '/')) return len(split(a:d2, '/')) - len(split(a:d1, '/'))
endfunction endfunction
function! s:change_to_root_directory() abort
if !empty(s:find_root_directory())
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
endif
return getbufvar('%', 'rootDir', '')
endfunction
" vim:set et nowrap sw=2 cc=80: " vim:set et nowrap sw=2 cc=80: