From d1ce686e09c20f21810eabd1ead38ef5e0318469 Mon Sep 17 00:00:00 2001 From: wsdjeg <wsdjeg@outlook.com> Date: Sun, 14 Jan 2018 23:08:56 +0800 Subject: [PATCH] Change root --- autoload/SpaceVim.vim | 7 +++++++ autoload/SpaceVim/layers/lang/c.vim | 1 + autoload/SpaceVim/plugins/projectmanager.vim | 5 +---- config/main.vim | 3 ++- doc/SpaceVim.txt | 7 +++++++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 91110e2c5..d13547ce2 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -414,6 +414,13 @@ let g:spacevim_enable_powerline_fonts = 1 let g:spacevim_lint_on_save = 1 let g:spacevim_search_tools = ['rg', 'ag', 'pt', 'ack', 'grep'] "" +" Set the project rooter patterns, by default it is +" `['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']` +let g:spacevim_project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] +"" +" Enable/Disable changing directory automatically. Enabled by default. +let g:spacevim_project_rooter_automatically = 1 +"" " Enable/Disable lint on the fly feature of SpaceVim's maker. Default is 0. " > " let g:spacevim_lint_on_the_fly = 0 diff --git a/autoload/SpaceVim/layers/lang/c.vim b/autoload/SpaceVim/layers/lang/c.vim index a290b2b7d..7f607bea6 100644 --- a/autoload/SpaceVim/layers/lang/c.vim +++ b/autoload/SpaceVim/layers/lang/c.vim @@ -87,6 +87,7 @@ function! SpaceVim#layers#lang#c#config() abort let g:neomake_cpp_enabled_makers = ['clang'] endif let g:chromatica#enable_at_startup=1 + call add(g:spacevim_project_rooter_patterns, '.clang') endfunction function! SpaceVim#layers#lang#c#set_variable(var) abort diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index 0c99e82b9..07b238f5d 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -106,10 +106,7 @@ function! SpaceVim#plugins#projectmanager#kill_project() abort endfunction -let g:spacevim_project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] - -let g:spacevim_project_rooter_manual_only = 0 -if !g:spacevim_project_rooter_manual_only +if g:spacevim_project_rooter_automatically augroup spacevim_project_rooter autocmd! autocmd VimEnter,BufEnter * call SpaceVim#plugins#projectmanager#current_root() diff --git a/config/main.vim b/config/main.vim index efad40b30..8466ab1f8 100644 --- a/config/main.vim +++ b/config/main.vim @@ -46,7 +46,6 @@ catch call zvim#util#source_rc('functions.vim') endtry -call SpaceVim#plugins#projectmanager#RootchandgeCallback() call zvim#util#source_rc('init.vim') @@ -59,6 +58,8 @@ call SpaceVim#server#connect() call SpaceVim#end() +call SpaceVim#plugins#projectmanager#RootchandgeCallback() + call zvim#util#source_rc('general.vim') diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 07972639e..27d36ac4e 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -437,6 +437,13 @@ Enable/Disable lint on save feature of SpaceVim's maker. Default is 1. let g:spacevim_lint_on_save = 0 < + *g:spacevim_project_rooter_patterns* +Set the project rooter patterns, by default it is `['.git/', '_darcs/', +'.hg/', '.bzr/', '.svn/']` + + *g:spacevim_project_rooter_automatically* +Enable/Disable changing directory automatically. Enabled by default. + *g:spacevim_lint_on_the_fly* Enable/Disable lint on the fly feature of SpaceVim's maker. Default is 0. >