fix: swap terminal split direction — wide→right, tall→bottom

This commit is contained in:
QQ 2026-06-11 16:46:36 +08:00
parent dcfef43b07
commit 8334f6042a
1 changed files with 5 additions and 5 deletions

View File

@ -38,15 +38,15 @@ G.map({
{ 'n', '<right>', ':vertical resize +5<CR>' },
})
-- 终端 / Reasonix根据窗口宽高自适应分屏方向(横屏→下方,竖屏→右侧)
-- 终端 / Reasonix横屏→右侧,竖屏→下方
do
local function split_term(ui, cmd)
local wide = ui.width > ui.height
local tall = ui.height > ui.width
local term = require('toggleterm.terminal').Terminal:new({
direction = wide and 'horizontal' or 'vertical',
-- 横屏→右侧(垂直分屏);竖屏→下方(水平分屏)
direction = tall and 'horizontal' or 'vertical',
cmd = cmd,
-- 横屏→高度 10 行;竖屏→宽度 ≈ nvimtree30 列)
size = wide and 10 or math.floor(ui.width * 0.3),
size = tall and 10 or math.floor(ui.width * 0.3),
})
term:toggle()
end