mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:40:05 +08:00
Fix project rooter
This commit is contained in:
parent
d98f1af1bd
commit
b9f36cbd55
@ -80,7 +80,6 @@ function! SpaceVim#autocmds#init() abort
|
||||
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
|
||||
autocmd ColorScheme gruvbox call s:fix_gruvbox()
|
||||
autocmd VimEnter * call SpaceVim#autocmds#VimEnter()
|
||||
autocmd User RooterChDir call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '')
|
||||
autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1
|
||||
augroup END
|
||||
|
@ -2,16 +2,14 @@ function! SpaceVim#layers#core#plugins() abort
|
||||
return [
|
||||
\ ['Shougo/vimproc.vim', {'build' : ['make']}],
|
||||
\ ['benizi/vim-automkdir'],
|
||||
\ ['airblade/vim-rooter', {'merged' : 0, 'loadconf' : 1}],
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
let s:filename = expand('<sfile>:~')
|
||||
let s:lnum = expand('<slnum>') + 3
|
||||
let s:lnum = expand('<slnum>') + 2
|
||||
function! SpaceVim#layers#core#config() abort
|
||||
let g:rooter_silent_chdir = 1
|
||||
let g:vimproc#download_windows_dll = 1
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'Rooter', 'find-project-root', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'call SpaceVim#plugins#projectmanager#current_root()', 'find-project-root', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill all project buffers', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 'p'], 'call SpaceVim#plugins#projectmanager#list()', 'List all projects', 1)
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
|
@ -73,10 +73,7 @@ function! SpaceVim#plugins#projectmanager#reg_callback(func) abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#projectmanager#current_root() abort
|
||||
try
|
||||
Rooter
|
||||
catch
|
||||
endtry
|
||||
call s:find_root_directory()
|
||||
return getcwd()
|
||||
endfunction
|
||||
|
||||
@ -106,6 +103,7 @@ function! s:find_root_directory() abort
|
||||
for pattern in g:spacevim_project_rooter_patterns
|
||||
call add(dirs, SpaceVim#util#findFileInParent(pattern, fd))
|
||||
endfor
|
||||
return s:sort_dirs(dirs)
|
||||
endfunction
|
||||
|
||||
|
||||
@ -114,7 +112,9 @@ function! s:sort_dirs(dirs) abort
|
||||
endfunction
|
||||
|
||||
function! s:change_to_root_directory() abort
|
||||
|
||||
if s:find_root_directory()
|
||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
let g:rooter_patterns = get(g:, 'rooter_patterns', ['.git', '.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'])
|
||||
if index(g:spacevim_plugin_groups, 'lang#c') != -1
|
||||
call add(g:rooter_patterns, '.clang')
|
||||
endif
|
||||
call add(g:rooter_patterns, '.projections.json')
|
Loading…
Reference in New Issue
Block a user