1

I am trying to run the command split from within GNU screen in order to create a new horizontal region. This command is instead interpreted as a call to the Unix split utility at /usr/bin/split for splitting files. The issue is that I want to start screen with a custom configuration using screen -c custom.conf where this configuration sets up a split environment of the form:

# custom.conf
split
screen 0 
exec some-command-here
focus next
screen 1
exec some-other-command
focus next

This custom configuration works fine for every step except the first, where it tries to run the split utility. My question is therefore whether there is: (a) another screen command to create a split that doesn't have utility conflicts; or (b) a way to call the screen split command that will only be interpreted by screen; or (c) a way to bypass the part of PATH containing /usr/bin/split for just this command.

The keyboard bindings for generating a horizontal split work fine, but as far as I'm aware they can't be added to a script. For further details, I am trying to set up vim for use as an IDE for Python/Julia/etc, following the guide at http://www.juliabloggers.com/vim-as-ide-for-julia/.

The lateral solution to this problem is to use tmux or another terminal multiplexer, but I would like to use screen. A solution for tmux might be:

#!/bin/bash
tmux new-session -d -s session_name some-command-here
tmux split-window -t session_name some-other-command
tmux select-pane -t 0
tmux attach-session -t session_name
0

There is a default key binding for split functionality. From man screen, "DEFAULT KEY BINDINGS":

C-a S (split) Split the current region horizontally into two  new ones.  
See also only, remove, focus.
  • Yes indeed, but as I detailed in the question I am trying to automate splitting on start up. I do not want to have to type the key binding to create the split, I want to script it to split automatically. – Lewis Jun 30 '17 at 11:22
  • @Lewis sorry, I will update my answer. – styrofoam fly Jun 30 '17 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.