mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:30:05 +08:00
Auto set project name
This commit is contained in:
parent
a5f349096f
commit
7468d6ec12
@ -79,6 +79,8 @@ function! SpaceVim#autocmds#init() abort
|
||||
autocmd BufWritePost *.vim call s:generate_doc()
|
||||
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', '')
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
|
@ -28,10 +28,21 @@ function! SpaceVim#plugins#projectmanager#list() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#projectmanager#current_()
|
||||
function! SpaceVim#plugins#projectmanager#current_name() abort
|
||||
return get(b:, '_spacevim_project_name', '')
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#projectmanager#RootchandgeCallback() abort
|
||||
|
||||
let project = {
|
||||
\ 'path' : getcwd(),
|
||||
\ 'name' : fnamemodify(getcwd(), ':t')
|
||||
\ }
|
||||
call s:cache_project(project)
|
||||
let g:_spacevim_project_name = project.name
|
||||
let b:_spacevim_project_name = g:_spacevim_project_name
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#projectmanager#current_root() abort
|
||||
try
|
||||
Rooter
|
||||
|
@ -31,6 +31,7 @@ function! s:parser_argv() abort
|
||||
endif
|
||||
endfunction
|
||||
let s:status = s:parser_argv()
|
||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
if s:status[0]
|
||||
let g:_spacevim_enter_dir = s:status[1]
|
||||
augroup SPwelcome
|
||||
|
Loading…
Reference in New Issue
Block a user