mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 03:00:06 +08:00
Improve g f in plugin manager
open the terminal only when the plugin's directory exists. close #3349
This commit is contained in:
parent
04d05de80b
commit
48cdcfee48
@ -644,9 +644,6 @@ function! s:open_plugin_dir() abort
|
|||||||
let line = line('.') - 3
|
let line = line('.') - 3
|
||||||
let plugin = filter(copy(s:ui_buf), 's:ui_buf[v:key] == line')
|
let plugin = filter(copy(s:ui_buf), 's:ui_buf[v:key] == line')
|
||||||
if !empty(plugin)
|
if !empty(plugin)
|
||||||
exe 'topleft split'
|
|
||||||
enew
|
|
||||||
exe 'resize ' . &lines * 30 / 100
|
|
||||||
let shell = empty($SHELL) ? SpaceVim#api#import('system').isWindows ? 'cmd.exe' : 'bash' : $SHELL
|
let shell = empty($SHELL) ? SpaceVim#api#import('system').isWindows ? 'cmd.exe' : 'bash' : $SHELL
|
||||||
let path = ''
|
let path = ''
|
||||||
if g:spacevim_plugin_manager ==# 'dein'
|
if g:spacevim_plugin_manager ==# 'dein'
|
||||||
@ -655,12 +652,25 @@ function! s:open_plugin_dir() abort
|
|||||||
let path = neobundle#get(keys(plugin)[0]).path
|
let path = neobundle#get(keys(plugin)[0]).path
|
||||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||||
endif
|
endif
|
||||||
if has('nvim') && exists('*termopen')
|
if isdirectory(path)
|
||||||
call termopen(shell, {'cwd' : path})
|
topleft new
|
||||||
elseif exists('*term_start')
|
exe 'resize ' . &lines * 30 / 100
|
||||||
call term_start(shell, {'curwin' : 1, 'term_finish' : 'close', 'cwd' : path})
|
if has('nvim') && exists('*termopen')
|
||||||
|
call termopen(shell, {'cwd' : path})
|
||||||
|
elseif exists('*term_start')
|
||||||
|
call term_start(shell, {'curwin' : 1, 'term_finish' : 'close', 'cwd' : path})
|
||||||
|
elseif exists(':VimShell')
|
||||||
|
exe 'VimShell ' . path
|
||||||
|
else
|
||||||
|
close
|
||||||
|
echohl WarningMsg
|
||||||
|
echo 'Do not support terminal!'
|
||||||
|
echohl None
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
exe 'VimShell ' . path
|
echohl WarningMsg
|
||||||
|
echo 'Plugin(' . keys(plugin)[0] . ') has not been installed!'
|
||||||
|
echohl None
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user