Skip to content

Add a CLI executable for interacting with WT (wtcli.exe or something) #11616

@3N4N

Description

@3N4N

Description of the new feature/enhancement

With the command sendInput I can invoke shell commands with a key-binding. But that would send the input directly to the pane currently in focus. I want to invoke a shell command in the background. Kind of like how moveFocus command operates.

The specific use-case I want this for is navigating between vim and wt splits with one set of keybindings. As of now, I have to use two sets: one for vim (ctrl-h/j/k/l) and another for wt (ctrl-alt-h/j/k/l). I'm used to tmux and had a config which achieved exactly this purpose.

I can do half of the work from vim: when inside vim, I can check if there are other vim splits in the direction I want to move focus toward, and if not, I move over to the wt split in that direction, with the command wt -w 0 mf <direction>.

But that's only half the work. Now I have to configure wt to send the key to vim if the current wt split is harboring a vim spawn. In tmux, I had a way to --

  1. See if the focused split has vim open
    tmux display-message -p '#{pane_current_command}' | grep -iq vim
  2. Bind a key to a complex bash command
    bind -n C-h run \
             "((tmux list-panes -F '#F' | grep -q Z && tmux send-keys C-h) || \
             ((tmux display-message -p '#{pane_current_command}' | grep -iq vim \
               && tmux send-keys C-h) || tmux select-pane -L ))"

None of which is achievable in wt. Or I haven't found a way.

By the way, I noticed that the shell command wt -w 0 mf <direction> is slower than the native moveFocus command. And I think the shell variant even opens a new wt window for a split second. Why is that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Commandlinewt.exe's commandline argumentsIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.Resolution-DuplicateThere's another issue on the tracker that's pretty much the same thing.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions