-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
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 --
- See if the focused split has vim open
tmux display-message -p '#{pane_current_command}' | grep -iq vim
- 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?