Where [s represent - splits, and {s represent | splits.
Unfortunately I don't think it is possible to handle all conditions as the window size and layouts are mutable and tmux-runner has no way of confirming if things have changed.
thinking more, I can simplify the problem by assuming that the Vim & runner will exist in the outermost split. An oversimplification, but likely true in the majority of cases. With that, I can determine the orientation by parsing the outermost / first orientation delimeter in the layout string:
function! CurrentMajorOrientation()
let orientation_map = { '[': 'v', '{': 'h' }
let layout = system("tmux display-message -p '#{window_layout}'")
let outermost_orientation = substitute(layout, '[^[{]', '', 'g')[0]
return orientation_map[outermost_orientation]
endfunction
Two related issues here, both occuring when running
:VtrReorientRunner
after manually attaching via:VtrAttachToPane
:s:vim_pane
variable is not set, causing theFocusVimPane
function to throw an error.|
split.Currently, if you attach to an existing pane, the orientation is not set. This can theoretically be improved as the layout can be determined with:
Where
[
s represent-
splits, and{
s represent|
splits.Unfortunately I don't think it is possible to handle all conditions as the window size and layouts are mutable and tmux-runner has no way of confirming if things have changed.
thinking more, I can simplify the problem by assuming that the Vim & runner will exist in the outermost split. An oversimplification, but likely true in the majority of cases. With that, I can determine the orientation by parsing the outermost / first orientation delimeter in the layout string: