diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index 09b1e1159..eaa3a099e 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -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 diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 723099c42..034f36071 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -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(':~') -let s:lnum = expand('') + 3 +let s:lnum = expand('') + 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('') + s:lnum - 1 diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index 86726bfdb..6d7cf899d 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -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 diff --git a/config/plugins/vim-rooter.vim b/config/plugins/vim-rooter.vim deleted file mode 100644 index 0a88c2fdb..000000000 --- a/config/plugins/vim-rooter.vim +++ /dev/null @@ -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')