Replies: 1 comment 7 replies
-
You'll probably need to have a delay after the Escape so the program recognises it as Escape then i and not as M-i. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I wrote a little send-keys script which inputs commands into every tmux pane open across all sessions and windows.
The simplified version of that is this. It runs in a dedicated bash script:
${COMMAND}
in this case can be any script such aswhoami
orecho 'hello world'
. It works. You can use it liketmux-shell-cmd "echo ok"
.Here's the new situation that I'm struggling with. I started to use https://github.com/jeffreytse/zsh-vi-mode which enables Vim modes in the terminal. For example you can be in either normal or insert mode.
Text can only be inserted when in insert mode. Each pane's shell can be in either mode and I wouldn't know that beforehand.
The easiest way to go about this is probably to send escape, followed by "i" and then send-keys the command itself. This forces all panes to consistently be in insert mode ready to accept a command.
I tried all sorts of things like
tmux send-keys -t "${pane}" "C-[" "i${COMMAND}" "C-m"
but that producesecho\sok
when the command variable isecho ok
. I also tried"C-[i${COMMAND}"
which of course produces the literal strings for those characters.Even if I remove that plugin and use zsh's default Vim key binds the same problem persists since it also has the concept of being in either normal or insert mode.
Beta Was this translation helpful? Give feedback.
All reactions