1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-15 08:09:11 +08:00

Open welcome page when argv(0) is a dir

This commit is contained in:
wsdjeg 2017-05-02 20:38:52 +08:00
parent d8fab64e57
commit 0d6aa65d0a
2 changed files with 21 additions and 2 deletions

View File

@ -494,6 +494,13 @@ function! SpaceVim#welcome() abort
if exists('g:_spacevim_checking_flag') && g:_spacevim_checking_flag
return
endif
let f = ''
if argc()
let f = expand(argv(0))
if isdirectory(f)
exe 'lcd ' . f
endif
endif
if exists(':Startify') == 2
Startify
endif
@ -501,7 +508,9 @@ function! SpaceVim#welcome() abort
\ && get(g:, '_spacevim_checking_flag', 0) == 0
if exists(':VimFiler') == 2
VimFiler
wincmd p
if empty(f)
wincmd p
endif
elseif exists(':NERDTreeToggle') == 2
NERDTreeToggle
wincmd p

View File

@ -64,10 +64,20 @@ function! SpaceVim#autocmds#init() abort
autocmd FocusGained * call s:reload_touchpad_status()
endif
autocmd BufWritePost *.vim call s:generate_doc()
autocmd VimEnter * if !argc() | call SpaceVim#welcome() | endif
autocmd VimEnter * if !s:with_file() | call SpaceVim#welcome() | endif
autocmd ColorScheme gruvbox call s:fix_gruvbox()
augroup END
endfunction
function! s:with_file() abort
if !argc()
return 0
elseif isdirectory(expand(argv(0)))
return 0
else
return 1
endif
endfunction
function! s:reload_touchpad_status() abort
if s:touchpadoff
call s:disable_touchpad()