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

perf(shell): add center-float position

This commit is contained in:
Eric Wong 2024-07-27 15:00:32 +08:00
parent 26e7f66fcd
commit 28c3ff6193
3 changed files with 16 additions and 2 deletions

View File

@ -200,6 +200,20 @@ function! s:open_default_shell(open_with_file_cwd) abort
\ })
exe win_id2win(s:term_win_id) . 'wincmd w'
elseif s:default_position ==# 'center-float' && exists('*nvim_open_win')
let s:term_win_id = nvim_open_win(bufnr('%'), v:true,
\ {
\ 'relative': 'editor',
\ 'width' : &columns - 10,
\ 'height' : &lines - 10,
\ 'row': 5,
\ 'border' : 'single',
\ 'col': 5
\ })
exe win_id2win(s:term_win_id) . 'wincmd w'
call nvim_set_option_value('winhighlight', 'NormalFloat:Normal,FloatBorder:WinSeparator', { 'win' : s:term_win_id})
else
" no terminal window found. Open a new window
let cmd = s:default_position ==# 'float' ?

View File

@ -44,7 +44,7 @@ The default shell is quickly accessible via a the default shortcut key `SPC '`.
### 设置终端打开位置及高度
在启用该模块时,可以通过 `default_position` 这一模块选项来指定终端打开的位置,
目前可以选的值为:`top`, `bottom`, `left`, `right`, `float` or `full`,默认的值为 `top`
目前可以选的值为:`top`, `bottom`, `left`, `right`, `float`, `center-float` or `full`,默认的值为 `top`
同时,可以通过 `default_height` 这一模块选项指定终端打开的高度,默认值为 30。

View File

@ -46,7 +46,7 @@ The default shell is quickly accessible via a the default shortcut key `SPC '`.
### Default shell position and height
It is possible to choose where the shell should pop up by setting the
variable `default_position` to either `top`, `bottom`, `left`, `right`, `float`
variable `default_position` to either `top`, `bottom`, `left`, `right`, `float`, `center-float`
or `full`. Default value is `top`. It is also possible to set the default height
in percents with the variable `default_height`. Default value is 30.