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

Fix project root detection to work with empty buffer (#3860)

This commit is contained in:
Aron Griffis 2020-10-14 07:42:18 -04:00 committed by GitHub
parent 9fdac3ac04
commit e720fd1990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,13 +231,14 @@ function! s:find_root_directory() abort
" @question confused about expand and fnamemodify
" ref: https://github.com/vim/vim/issues/6793
" get the current path of buffer
" If it is a empty buffer, do nothing?
" get the current path of buffer or working dir
let fd = expand('%:p')
if empty(fd)
call s:LOGGER.info('buffer name is empty, skipped!')
return ''
let fd = getcwd()
endif
let dirs = []
call s:LOGGER.info('Start to find root for: ' . s:FILE.unify_path(fd))
for pattern in s:project_rooter_patterns