microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.74k stars 8.33k forks source link

Scenario: Add support for panes #1000

Open zadjii-msft opened 5 years ago

zadjii-msft commented 5 years ago

image

This is the megathread for tracking all the work related to Panes in the Windows Terminal.

1.0 Features

1.0 Features * [x] Original issue: #532 -> added in #825 * [x] #991 Panes should be resizable with the keyboard. (fixed PR #1207) * [x] #995 The user should be able to navigate the focus of panes with the keyboard, instead of requiring the mouse. (PR #1910) * [x] #993 There's no keyboard shortcut for "ClosePane" * [x] #998 Open panes with a specific profile * [x] #994 There should be some sort of UI to indicate that a particular pane is focused, more than just the blinking cursor. `tmux` accomplishes this by colorizing the separators adjacent to the active pane. Another idea is displaying a small outline around the focused pane (like when tabbing through controls on a webpage). (PR:#3060) * [x] #999 If you click on the separator's between panes, then no panes will be focused (PR #3540) * [x] #3045 Moving focus between panes doesn't always work (PR #3958) * [x] #3544 Add a default keybinding for panes, to enable them by default. (PR #3585) * [x] #2834 Snap to character grid when resizing window (PR #3181) * [x] #3960 Automatic splits similar to tiling window managers

1.x features / bugs

2.0 Features / Bugs

Panes Titlebar Follow-ups - See #4998

Backlog items

Theming items

DHowett-MSFT commented 5 years ago

We didn't commit the keybinding constants in with which people could opt. ☹️

decriptor commented 5 years ago

I noticed that @zadjii-msft added the keybindings for panes back. I'm assuming it made it into 0.1.1621.0?

If I add this block:

                "command" : "splitHorizontal",
                "keys" : 
                [
                    "ctrl+shift+-"
                ]
            },
            {
                "command" : "splitVertical",
                "keys" : 
                [
                    "ctrl+shift+|"
                ]
            },

Only Horizontal works. I noticed that if I close Windows Terminal it deletes the splitVertical keybinding from profiles.json.

zadjii-msft commented 5 years ago

@decriptor I believe that's because '|' isn't actually a key we support in the keybindings quite yet - see #1212

decriptor commented 5 years ago

@zadjii-msft I believe you are right. I used ctrl+1 as a test and it didn't remove it.

Jaykul commented 5 years ago

I know you really want it, @zadjii-msft but you have #998 on your list twice ;-)

zadjii-msft commented 5 years ago

@jaykul good catch, those are supposed to be separate issues.

akulbe commented 5 years ago

@zadjii-msft and @Jaykul - just let me know where to send the care packages (hoppy beverages / candy / beef jerky / etc) 😆

Cannot wait for panes to be implemented!

Fumler commented 5 years ago

Any chance of getting "focus follows mouse" like in iterm2 and other terminals? So if this setting is turned on, the active pane would be the pane you have your mouse pointer over, without having to click it first.

jwhipp commented 5 years ago

I know you guys are hard at work on this, literally the only thing keeping it from being a full-time tool for me.

My request is that you look at this product for inspiration for split panes:

https://gnunn1.github.io/tilix-web/

After trying so many terminals, I feel like this is the one software that truly gets panes done the right way.

I am presently running this under WSL+Xming as a work around for the lack of decent split pane terminals under Windows.

phalox commented 5 years ago

https://gnunn1.github.io/tilix-web/

After trying so many terminals, I feel like this is the one software that truly gets panes done the right way.

What's the difference with Terminator? This paned-terminal worked the best for everything I did; usually in a 4 pane setup! Awesome when developing!

LukeCarrier commented 5 years ago

@phalox the keybindings in Tilix are pretty awesome and it's a very polished GTK 3 app. If you like Terminator there's a chance you'll love Tilix ;-)

jwhipp commented 5 years ago

What's the difference with Terminator? This paned-terminal worked the best for everything I did; usually in a 4 pane setup! Awesome when developing!

I actually loved Terminator for the longest time and found Tilix during the Unity -> Gnome transition with Ubuntu. Terminator isn't seeing a lot of development these days and a number of bugs haven't been fixed. Like @LukeCarrier said, Tilix is just way more polished and has some neat features like the easy of keybindings and of multi-tab input and more advanced tab grouping.

I think both Tilix and Terminator are suitable for this project to use as a basis for how panes should work.

ksawerykarwacki commented 5 years ago

Last RN states that there are two new keybindings resizePane{Up,Down,Left,Right} & moveFocus{Up,Down,Left,Right} is there any sample how this configuration should look like? I cannot write any valid json to handle that.

zadjii-msft commented 5 years ago

08 May 2020 EDIT - This is no longer up-to-date, see below

Old message content @ksawerykarwacki this is the blob I use for my pane settings typically: ```json { "keys": ["alt+shift+-"], "command": "splitHorizontal" }, { "keys": ["alt+shift+plus"], "command": "splitVertical" }, { "keys": ["alt+shift+left"], "command": "resizePaneLeft" }, { "keys": ["alt+shift+right"], "command": "resizePaneRight" }, { "keys": ["alt+shift+up"], "command": "resizePaneUp" }, { "keys": ["alt+shift+down"], "command": "resizePaneDown" }, { "keys": ["alt+left"], "command": "moveFocusLeft" }, { "keys": ["alt+right"], "command": "moveFocusRight" }, { "keys": ["alt+up"], "command": "moveFocusUp" }, { "keys": ["alt+down"], "command": "moveFocusDown" }, { "keys": ["ctrl+shift+w"], "command": "closePane" }, ```

The above keybindings were deprecated in 0.11. The new syntax for these can be found in the default settings for the Terminal: https://github.com/microsoft/terminal/blob/28dc8196ab38328fa5466d24ebfb339d87d191a5/src/cascadia/TerminalApp/defaults.json#L307-L318

cdmihai commented 5 years ago

What about the feature of dynamically resizing a pane to displayed contents when double clicking it's right separator? Similar to snapping to contents when double clicking column separators in Excel. Many other UIs have this affordance.

moswald commented 5 years ago

FWIW, I think #756 is pretty important to calling pane support "done". I've been using ConEmu up until now, and it's nice how it opens up with my console panes pre-split and sized the way I like, and with the correct profiles loaded.

jwhipp commented 5 years ago

I think that this is not the main feature, since soon it will not need to be implemented inside the ...

Very much disagree because tmux isn't a user friendly, modern UI experience. Tmux and similar tools (like Byobu) are great for remote panes/tabs but it's not a great mouse/desktop experience. The best Linux terminals and terminals competing for usage on Windows are implementing split panes.

Also, I am testing split panes now with the latest Windows store build and the feature working amazingly well. Key binds are splitVertical and splitHorizontal for those looking to test as well.

vrokolos commented 5 years ago

This is awesome!! didn't know it worked. works flawlessly

What I need is a way to open a bunch of scripts into panes from an external shortcut (4 webpacks in a single terminal with 4 panes automatically). Is there a way to do that?

eduardonunesp commented 5 years ago

Thanks @zadjii-msft ! you deserve the AwesomeDudePrize :)

mucahityilmaz commented 5 years ago

First of all, thanks for all of your work about panes.

I don't have a feature request but it took a while for me to find this issue, so there should be some information on PowerShell docs about these features, or at least some links here with the command tags. Maybe adding to the first entry here something like "Add docs"?

DHowett-MSFT commented 5 years ago

@mucahityilmaz thanks for the request! Panes are intentionally underdocumented because they’re not yet finished.

DHowett-MSFT commented 5 years ago

(And I believe docs will come in with “enable a key binding for them by default”) :smile:

matt-kempster commented 4 years ago

In #532, from @zadjii-msft:

I did not know that Tmux Control Mode even existed. That sounds really awesome, I'm totally on board with trying to make that work somehow.

Was there any further thought put into this? I love tmux control mode - it's literally the only thing keeping me tethered to MacOS at work (since only iTerm supports it, and iTerm is mac-only). If it were implemented, I'd trash my Mac and request a Windows laptop immediately.

I'd love to see it listed as a post-1.0 milestone :)

zadjii-msft commented 4 years ago

@matt-kempster You're right, we should have a tmux control mode task. Thanks for keeping me honest :)

jwhipp commented 4 years ago

I am sure this is on the radar, but the panes aren't mouse/keyboard re-sizable right now (unless there's a hidden tmux like keybinding I just don't know about). I'd like to be able to drag on the splitters like Terminator or Tilix.

zadjii-msft commented 4 years ago

@jwhipp

  • [x] #991 Panes should be resizable with the keyboard. (fixed PR #1207)
  • [ ] #992 Panes should be resizable with the mouse. The user should be able to drag the separator for a pair of panes, and have the content between them resize as the separator moves.
gabrieledarrigo commented 4 years ago

Just a question, there's no way to open/close a pane with a mouse action?

For example, as in iTerm2, a right-click that opens a context menu where a user could select "Split pane Vertically" or "Split pane Horizzontaly".

Don't know if this was already tracked or discussed since it wasn't clear from the todo list so forgive me if this is a duplicate question : )

zadjii-msft commented 4 years ago

@gabrieledarrigo I believe you're correct, we don't really have a issue tracking specifically that request currently. It's definitely something we'd like, but probably as a part of #3337/#1912. Those are the issues tracking adding a context menu to various parts of the UI, and I think that adding splits to that menu will certainly be part of that design.

danielboth commented 4 years ago

What about running each pane in a different user context (aka runas)? Is that possible already / is that tracked somewhere?

zadjii-msft commented 4 years ago

I don't think that's possible for the Terminal to support directly, though I'd assume that you could just set the commandline to runas /user:<whatever> pwsh.exe (or whatever runas commandline you want). With #3825 you can even specify a manual commandline for spitPane that would override the profile's commandline, like so:

{ "keys": ["ctrl+f"], "command": { "action": "splitPane", "split": "horizontal", "profile": "profile1", "commandline": "foo.exe" } },
danielboth commented 4 years ago

Hi @zadjii-msft, I tested that scenario (calling runas.exe), but that spawns the new shell window (pwsh, but also tested with cmd) outside of terminal (as in, a new window similar what you would get if you would just launch cmd or pwsh outside of terminal).

ZimGil commented 4 years ago

How about a switch panes option? Like a switchLeft, switchRight, switchUp, switchDown,
To allow the user to rearrange the panes layout

Luke87pl commented 4 years ago

Does the splitPane command have option to split to same profile as current one, instead of specific profile?

olfek commented 4 years ago

How do I close a pane after creating one using alt+shift++ or alt+shift+-?

ucavalcante commented 4 years ago

How do I close a pane after creating one using alt+shift++ or alt+shift+-?

with that default command below.

{ "command": "closePane", "keys": [ "ctrl+shift+w" ] },

zadjii-msft commented 4 years ago

Does the splitPane command have option to split to same profile as current one, instead of specific profile?

@Luke87pl That's being tracked by "Allow the user's "open pane" bindings to open a pane with the current pane" #1756

acshef commented 4 years ago

Can I have a profile that always opens as a split pane? Something like:

{
    "name": "Profile3",
    "commandline": "wt -p \"Profile1\" ; split-pane -H -p \"Profile2\""
}

(Which currently opens a new instance of Windows Terminal)

bgshacklett commented 4 years ago

Regarding the visual indication of which pane is active, I'd love to see the inactive pane(s) dimmed the way it's done in iTerm2.

stweedie commented 4 years ago

any reason why moving left / right between panes doesn't respect current row?

All the time I have panes aligned in a square, and I want to go from bottom left to bottom right. Using the keybinding for moveFocusRight puts me in the TOP right pane

jawn commented 4 years ago

@stweedie, is this what you are looking for?

#2398

stweedie commented 4 years ago

that is what I was looking for, thanks

Trolldemorted commented 4 years ago

I wrote a startup script which chains multiple split-pane commands, but it always splits one of the results of the last split:

grafik

Can I convice wt somehow to also split the left or top right pane? As you can see the resulting segmentation is neither ideal, nor what all users want.

If not, is there a feature request for that?

anthonyvdotbe commented 4 years ago

@Trolldemorted as is mentioned in the OP:

4340 Choose Direction to Split Pane

Trolldemorted commented 4 years ago

4340 would allow me to specify whether I want to split the right or left pane, but not to split both, right?

anthonyvdotbe commented 4 years ago

Ah yes. What about #3759?

Trolldemorted commented 4 years ago

Depending how they solve it it might partially cover that, but it won't cover the "commit a batch script in your repository which starts wt in a grid layout" use case, correct? Every user would have to create a profile manually, or we'd have to touch the users' profiles in our batch script.

zadjii-msft commented 4 years ago

So, #4340 "Choose Direction to Split Pane" might be helpful yes, but then you'll still get stuck splitting panes down just one branch of the tree.

What you really want is probably #6580, which will let you move-focus in the commandline, so you'll be able to navigate to other panes and split those.

Also maybe helpful in the future:

Trolldemorted commented 4 years ago

Thanks @zadjii-msft ! Let's hope #6580 will make it to the roadmap soon.

Can I specify an initial command for the shells somehow? Right now I am using -d . powershell.exe -NoExit -Command someshellcommand, but I am unable to rerun that command with arrow up + enter (it doesn't show up, only old commands from old shells are showing). Tried to do it with add-history, but without success.

JelteF commented 3 years ago

"#6459 Pane focus follows mouse" can be checked off the list, a fix for it has been merged a while back.

zadjii-msft commented 3 years ago

@JelteF Thanks! Cleaned that up a bit ☺️