Scripts and .screenrc to make GNU Screen splits easier
Update Thursday, 3rd of August 2017, 11:04:30 AM: much better to use bind
over stuff
to run a script within the .screenrc
file.
I enjoy GNU screen
via Cygwin on Windows a lot, but some of the commands get a bit fiddly. Creating splits is like that: you create a split, then move to it, then assign a window to it.
My first set of shortcuts were to create scripts to do those jobs.
To make a vertical split:
To make a horizontal script:
Lastly, key bindings that go in my .screenrc
file to run those scripts.
# ------------------------------ # SPLIT HORIZONTALLY OR VERTICALLY. # ------------------------------ # Uses split scripts. # Control+a, V for vertical; control+a, H for horizontal. # bind V stuff 'screenSplitVertical'\012'' # bind H stuff 'screenSplitHorizontal'\012'' bind V exec $HOME/bin/screenSplitVertical.sh bind H exec $HOME/bin/screenSplitHorizontal.sh
Explanation for version that uses exec:
bind V
says the rest of this line will be executed upon "control+a, shift+v
"exec
means run the rest of the line as a command.$HOME/bin/screenSplitVertical.sh
is the full path to the command (script) I want to run.
Explanation for version that uses stuff:
bind V
says the rest of this line will be executed upon "control+a, shift+v
"stuff
will "write stuff to the command line" or "stuff text onto the command line".'screenSplitVertical'\012''
will write out the command screenSplitVertical.sh and then '\012' which outputs a newline (ENTER key) to actually cause the script to run.
In general, exec
is more suitable than stuff
in this situation because stuff
will leave the command in my command history.
More screen magic? Check out joaopizani's .screenrc config for some great ideas about resizing splits and moving between them.