diff --git a/lua/keymap.lua b/lua/keymap.lua index 9fb0071..0cfca1a 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -38,15 +38,15 @@ G.map({ { 'n', '', ':vertical resize +5' }, }) --- 终端 / 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 行;竖屏→宽度 ≈ nvimtree(30 列) - 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