mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:30:05 +08:00
Fix SPC '
This commit is contained in:
parent
e68fb5f706
commit
cc40bf717d
@ -17,7 +17,7 @@ function! SpaceVim#layers#shell#plugins() abort
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#shell#config()
|
||||
function! SpaceVim#layers#shell#config() abort
|
||||
|
||||
call SpaceVim#mapping#space#def('nnoremap', ["'"], 'call call('
|
||||
\ . string(function('s:open_default_shell')) . ', [])',
|
||||
@ -25,14 +25,22 @@ function! SpaceVim#layers#shell#config()
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#shell#set_variable(var)
|
||||
function! SpaceVim#layers#shell#set_variable(var) abort
|
||||
let s:default_shell = get(a:var, 'defaut_shell', 'terminal')
|
||||
let s:default_position = get(a:var, 'default_position', 'top')
|
||||
let s:default_height = get(a:var, 'default_height', 30)
|
||||
endfunction
|
||||
|
||||
|
||||
let s:shell_win_nr = 0
|
||||
function! s:open_default_shell() abort
|
||||
if s:shell_win_nr != 0 && getwinvar(s:shell_win_nr, '&buftype') ==# 'terminal' && &buftype !=# 'terminal'
|
||||
exe s:shell_win_nr . 'wincmd w'
|
||||
return
|
||||
endif
|
||||
if &buftype ==# 'terminal'
|
||||
bwipeout! %
|
||||
return
|
||||
endif
|
||||
let cmd = s:default_position ==# 'top' ?
|
||||
\ 'topleft split' :
|
||||
\ s:default_position ==# 'bottom' ?
|
||||
@ -44,4 +52,14 @@ function! s:open_default_shell() abort
|
||||
if lines < winheight(0) && (s:default_position ==# 'top' || s:default_position ==# 'bottom')
|
||||
exe 'resize ' . lines
|
||||
endif
|
||||
if s:default_shell ==# 'terminal'
|
||||
if exists(':te')
|
||||
exe 'te'
|
||||
let s:shell_win_nr = winnr()
|
||||
else
|
||||
echo ':terminal is not supported in this version'
|
||||
endif
|
||||
elseif s:default_shell ==# 'VimShell'
|
||||
VimShell
|
||||
endif
|
||||
endfunction
|
||||
|
@ -71,7 +71,7 @@ let g:terminal_color_15 = '#ebdbb2'
|
||||
augroup Terminal
|
||||
au!
|
||||
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id | IndentLinesDisable
|
||||
au BufWinEnter term://* startinsert | IndentLinesDisable
|
||||
au WinEnter,BufWinEnter term://* startinsert | IndentLinesDisable
|
||||
if has('timers')
|
||||
au TermClose * let g:_spacevim_termclose_abuf = expand('<abuf>') | call timer_start(5, 'SpaceVim#mapping#close_term_buffer')
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user