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

Open
opened 2026-01-31 04:45:45 +00:00 by claunia · 0 comments
Owner

Originally created by @3N4N on GitHub (Oct 26, 2021).

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?

Originally created by @3N4N on GitHub (Oct 26, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> 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 tmux display-message -p '#{pane_current_command}' | grep -iq vim ``` 2. Bind a key to a complex bash command ```tmux 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? <!-- # Proposed technical implementation details (optional) A clear and concise description of what you want to happen. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15693