2

Let's say I have a window with two panes (size irrelevant, 'A' = active)

+-----+-----+
|     |  A  |
|     |     |
|     |     |
|     |     |
+-----+-----+

If I were to split-window I would get:

+-----+-----+
|     |  A  |
|     |     |
|     +-----+
|     |     |
+-----+-----+

Which is normally fine. But can I tell it to split the parent window instead of the current pane? Eg:

+-----+-----+
|     |  A  |
|     |     |
+-----+-----+
|           |
+-----------+

2 Answers 2

4

Try this: :splitw -v -f

According to this description:

The -f option creates a new pane spanning the full window height (with -h) or full window width (with -v), instead of splitting the active pane.

I guess it is still not as versitle as the "parent pane" design, but will solve many less complicated layouts easily.

3
  • It effectively is splitting the parent pane, perfectly versatile.
    – Matthew
    May 2, 2019 at 17:35
  • 1
    @jgillman This should be the correct answer.
    – chakrit
    Aug 12, 2019 at 12:51
  • This is the correct answer! Sorry for the long delay, got distracted by a thing for 10 years.
    – jgillman
    Mar 10 at 22:29
0

Original Answer:
The splitw command supports specifying a target.
Use -t to specify a pane.

Ctrl-B :splitw -t 0

On a very useful side note:

Ctrl-B q
will help to identify what pane to use.

Want to do that frequently to the same pane (like pane number zero, instead of the "current pane")? Then create a keyboard binding.

Expansion to answer:
The following will create the layout that was requested by the ASCII art in the question.

(1): Start with a brand new window. Maybe not strictly required, but I did this to simplify testing.
(2): Make a vertical split (Ctrl-B :splitw -h )
(3): Optional, but recommended: do something in pane #1 so that the pane looks different, just so you can see that this works as intended. (4): press Ctrl-B
(5): Although you need a colon, that is part of the following text. Paste in the following text.

:splitw -t 0 ; splitw -t 0 -h ; selectp -t 1 ; swap-pane -s 3 ; selectp -t 1 ; kill-pane -t 1

(6): Press Enter, to run the compound command.

Note (7): The approach shown depends on specific pane numbers, so step (1) is extremely recommended. I'm not saying that this solution is highly adaptable for other layouts, and so hard-coding the keyboard binding may produce unexpected results in other starting situations. However, this does show how to do what was specifically requested, so this may be a useful demonstration on how to do this manually (which is often helpful when designing an automated approach to a task).
Note (8): I'm quite wary about this approach, especially with the use of kill-pane. It seems that could easily lead to lost work if something doesn't work quite as expected. If you're gutsy enough to want to try putting this into a key binding, consider using the confirm statement, as shown with the default binding for Ctrl-B x (shown with Ctrl-B ?).

2
  • I appreciate your response, but your examples will only produce the split in my first example. That is to say, it still only splits the target pane, not the "parent" window. I don't think it's possible to split in the way I've specified with an existing vertical split.
    – jgillman
    Jan 13, 2015 at 17:59
  • Feedback received. Details in the ASCII art just didn't have enough attention placed to them. In response, original answer has been significantly expanded.
    – TOOGAM
    Jan 14, 2015 at 2:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .