Shelljs -- how do I represent the tmux base command "Ctrl-B" as a command?

297 views Asked by At

I'm trying to use shelljs to write a script that'll help load up my local env at once while setting up my tmux panes/windows... but I don't know how to represent the Ctrl button in the command.

Help? :-|

example of what I thought would work: shell.exec('Control+b z');

1

There are 1 answers

2
michalhonc On

Solution with keyboard shortcuts is probably not possible (not to my knowledge).

But that's the part where tmux command takes part.

For example in my setup I want to open two side panels along with main pane.

I'm using following with Guake terminal:

// Rename tab to current path
shell.exec(`guake --rename-current-tab=${path} &`);
// Open new horizontal pane
shell.exec('tmux split-window -h');
// Open new vertical pane under pane that was created above
shell.exec('tmux split-window -v');

Here you can find a cheatsheet for tmux commands: https://gist.github.com/MohamedAlaa/2961058