I recently became enamored with the excellent app in Ubuntu GNU screen. I was really happy to see it installed on my Mac as well, but I can't split vertically… I guess I need to update it somehow. I tried mac ports, and brew, but I couldn't find anything. Has anyone done this successfully?
Macos – Vertical Split in GNU Screen on Mac OS X
gnu-screenmacosterminal
Related Solutions
If you are restricted to only using screen, then the solution is like this (also works for non-split or horizontally-split screen windows):
- Use
crtl+a [
to go into copy mode - navigate using the arrow keys or hjkl keys (vi-style)
- use
space
to mark the start of your selection - use
space
to mark the end of your selection, copy to screen's buffer and exit copy mode - use
ctrl+a ]
to paste
Fancier movement keys (e.g. move to start of line/buffer) can be found here.
If you are not restricted to using the vanilla OSX terminal + screen, you may want to try some terminal that natively supports vertical splitting and run a separate screens on the left and right vertical panels. One terminal that supports this is iTerm2.
With terminal-supported vertical splits you can copy-paste using the mouse as-usually. You will still have to use the screen shortcuts to copy stuff from the screen scrollback buffer.
If you go with iTerm2, then you may also consider ditching screen altogether and switch to this version of Tmux. Tmux is a replacement for screen. The customized version above seamelessly integrates with iTerm2. I.e. opening/closing new screens is handled with iTerm2 shortcuts, and the scrollback buffer is directly accessible without having to switch to some special tmux mode.
The related posting Mac OS X terminal and GNU screen scrollback essentially advises you to suppress switching to the alternate screen of xterm. While in the alternate screen, you would not necessarily be able to use the scroll-wheel to see xterm's scrollback. A program running in xterm
would only see the escape sequences if it enables the xterm mouse protocol.
By default, screen
does not do this. It does have a setting which enables the mouse protocol, called mousetrack
:
This command determines whether
screen
will watch for mouse clicks. When this command is enabled, regions that have been split in various ways can be selected by pointing to them with a mouse and left- clicking them. Without specifying on or off, the current state is displayed. The default state is determined by the"defmousetrack"
command.
But
- this is a fairly new feature (mentioned in Mouse in screen(1) on the Linux console?)
- its description does not hint that it will help with scrolling in a window
Instead (see the first couple of links), some users have altered the xterm configuration to send screen-commands as the result of the scrolling wheel. A drawback to doing that is that it works only for the combination of xterm+screen.
Best Answer
Patch by Evan Meagher: http://old.evanmeagher.net/2010/12/patching-screen-with-vertical-split-in-os
Using these instructions and patch to compile screen I now have screen with vertical splitting capability in Mac OS X