1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

fix(startup): fix startify

close https://github.com/SpaceVim/SpaceVim/issues/4706
This commit is contained in:
wsdjeg 2022-11-13 00:02:20 +08:00
parent ba9af706be
commit 6afcc76a49

View File

@ -1603,9 +1603,25 @@ function! s:parser_argv() abort
" if use embed nvim
" for exmaple: neovim-qt
" or only run vim/neovim without argvs
if index(v:argv, '--embed') !=# -1
\ || len(v:argv) == 1
if len(v:argv) == 1
return [0]
elseif index(v:argv, '--embed') !=# -1
if v:argv[-1] =~# '/$'
let f = fnamemodify(expand(v:argv[-1]), ':p')
if isdirectory(f)
return [1, f]
else
return [1, getcwd()]
endif
elseif v:argv[-1] ==# '.'
return [1, getcwd()]
elseif isdirectory(expand(v:argv[-1]))
return [1, fnamemodify(expand(v:argv[-1]), ':p')]
elseif filereadable(v:argv[-1])
return [2, get(v:, 'argv', ['failed to get v:argv'])]
else
return [0]
endif
elseif index(v:argv, '-d') !=# -1
" this is diff mode
return [2]
@ -1619,7 +1635,7 @@ function! s:parser_argv() abort
elseif v:argv[-1] ==# '.'
return [1, getcwd()]
elseif isdirectory(expand(v:argv[-1]))
return [1, fnamemodify(expand(v:argv[1]), ':p')]
return [1, fnamemodify(expand(v:argv[-1]), ':p')]
else
return [2, get(v:, 'argv', ['failed to get v:argv'])]
endif
@ -1741,7 +1757,9 @@ function! SpaceVim#welcome() abort
endif
if exists(':Startify') == 2
Startify
if isdirectory(bufname(1))
if isdirectory(bufname(1)) && bufnr() !=# 1
" startify will not change the buffer name
" if you run `nvim test/`, the buffer name is `test/`.
bwipeout! 1
endif
endif