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

fix(projectmanager): remove log info

This commit is contained in:
wsdjeg 2022-10-26 17:35:33 +08:00
parent d3a2916dc8
commit 665727ada3
2 changed files with 15 additions and 13 deletions

View File

@ -200,6 +200,7 @@ function! SpaceVim#autocmds#VimEnter() abort
call SpaceVim#layers#core#tabline#def_colors()
set showtabline=2
endif
call SpaceVim#logger#info('run root changed callback on VimEnter!')
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
if !empty(get(g:, '_spacevim_bootstrap_after', ''))
try

View File

@ -139,11 +139,11 @@ end
local function change_dir(dir)
if dir == sp_file.unify_path(fn.getcwd()) then
logger.debug('same as current directory, no need to change.')
return false
else
if dir ~= nil then
logger.info('change to root: ' .. dir)
sp.cmd(cd .. ' ' .. sp.fn.fnameescape(sp.fn.fnamemodify(dir, ':p')))
end
logger.info('change to root: ' .. dir)
sp.cmd(cd .. ' ' .. sp.fn.fnameescape(sp.fn.fnamemodify(dir, ':p')))
return true
end
end
@ -170,14 +170,14 @@ end
local function find_root_directory()
local fd = fn.bufname('%')
if fn == '' then
logger.debug('bufname is empty')
if fd == '' then
logger.debug('bufname is empty, use current directory instead!')
fd = fn.getcwd()
end
logger.debug('start to find root for: ' .. fd)
local dirs = {}
logger.debug('searching rooter_patterns:' .. vim.inspect(project_rooter_patterns))
for _, pattern in pairs(project_rooter_patterns) do
logger.debug('searching rooter_patterns:' .. pattern)
local find_path = ''
if string.sub(pattern, -1) == '/' then
if sp_opt.project_rooter_outermost == 1 then
@ -245,10 +245,10 @@ if sp_opt.enable_projects_cache == 1 then
end
sp.cmd([[
let g:unite_source_menu_menus = get(g:,'unite_source_menu_menus',{})
let g:unite_source_menu_menus.Projects = {'description': 'Custom mapped keyboard shortcuts [SPC] p p'}
let g:unite_source_menu_menus.Projects.command_candidates = get(g:unite_source_menu_menus.Projects,'command_candidates', [])
]])
let g:unite_source_menu_menus = get(g:,'unite_source_menu_menus',{})
let g:unite_source_menu_menus.Projects = {'description': 'Custom mapped keyboard shortcuts [SPC] p p'}
let g:unite_source_menu_menus.Projects.command_candidates = get(g:unite_source_menu_menus.Projects,'command_candidates', [])
]])
if sp_opt.project_auto_root == 1 then
sp.cmd('augroup spacevim_project_rooter')
@ -382,8 +382,9 @@ function M.current_root()
end
fn.setbufvar('%', 'rootDir', rootdir)
end
change_dir(rootdir)
M.RootchandgeCallback()
if change_dir(rootdir) then
M.RootchandgeCallback()
end
return rootdir
end