Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
vim 是否提供函数或以某种方式返回指示符来区分拆分窗口的类型?我希望能够跟踪拆分是水平的还是垂直的。我想使用脚本中的信息来运行某些操作,具体取决于拆分是 H 还是 V。
例如,要检查窗口是否处于水平拆分状态,您可以获取其高度并将其与屏幕总高度进行比较。
if winheight(0) + &cmdheight + 1 != &lines " current window is part of a horizontal split endif
(命令行和状态行高度的条件因素也是如此)。
对于垂直拆分检查,您只需要:
if winwidth(0) != &columns " current window is in a vertical split endif