Unable to use Splits effectively in Screen - gnu-screen

I searched unsuccessfully Screen's info manual in Emacs by C-s. I was not able to search all nodes at once.
I can create a split by
C-a S
in Screen, move between them by
C-a TAB
and close them by
C-a X
However, I cannot launch anything on them. I have now two same windows in two splits.
I want to start a new session in other split, similarly as in Vim by
:args newFile
How can you start a new session in the second split?

C-a c will create a new screen window in the current split.
You can also execute commands in screen by typing C-a : and then the command, then Enter. Then you could do something similar to what you're describing:
:screen vi look-a-new-screen-window-started-with-vi.txt
Also, since you might be used to Vim's window-movement keys, try binding the C-a j to moving to the next split down and C-a k to move to the previous split upward, just like Vim's C-w j and C-w k. In your .screenrc:
bind j focus down
bind k focus up
While I'm sharing screen stuff, here's a handy bit to add to your screenrc to give you a nice status bar at the bottom showing all of your screen windows with the current one highlighted:
hardstatus alwayslastline "%{k}%-w%{.kY}%n %t%{-}%+w %= %H: %l %d/%m %c"
Rename a window with C-a A.

C-a c to create a new window (and immediately switch to that window)
C-a w to list windows
C-a and a window number to switch windows.
You can change default keybindings using a screenrc file, but I don't think you can bind multiple commands to a single keypress.
However, if there's a common set of screens that you're using you can get screen to start with these already open (and running whichever programs you want) by default. Check out the screenrc's on dotfiles for some great tips.
A simple ~/.screenrc for getting screen to automatically open a couple of sessions (with a split is as follows)
screen -t vim vim
split
focus down
startup_message off
screen -t home
Which will open two screen sessions with a split, the first named vim (running vim) and the second named home, just waiting with the normal shell prompt.
You can use different screenrc files with screen -c nameOfYourScreenRC, so if you wanted a different screenrc file to set up a vim session and a gdb session you could just do screen -c gdbscreenrc if you'd set up the appropriate file.

Related

How to use the terminal tabs feature in mintty/MSYS2?

According to https://github.com/mintty/mintty/issues/944 since mintty 3.5.1 there should be a tab bar where you can open multiple tabs with terminals in parallel. For that reason I performed an installation of MSYS2 which includes mintty 3.5.1, as this seems to be the way how to use the mintty. (I verified this with invoking mintty with -V.)
However, I do not find no possibility for opening and/or managing tabs in the UI.
My requirement: I would very much like to have tabs for organizing terminals in parallel.
My question: What's going on here? Did I miss something? Do I need to execute the mintty/MSYS2 with some special commad line options? How can I enable tabs?
You could use --tabbar option when staring minnty. see here for more information.
It was difficult for me to figure out how to turn this feature on. The answer is sprinkled through the comments of this issue, but not in one place. Therefore I'm posting this to save time for others. Here's how you turn the feature on:
Add --tabbar=4 or --tabbar to the windows shortcut that opens mintty:
The 4 is documented here:
no geometry handling; terminal session windows are separate [default]
sync. position/size when switching/launching/closing a session
sync. also when window is moved or resized
sync. also when window is minimized
sync. also when window is started separately
If you'd like to create new tabs with ctrl-shift-t, close tabs with ctrl-shift-w, switch to previous tabs with ctrl-shift-tab, and switch to next tabs with ctrl-tab, add -o "KeyFunctions=t:new-window-cwd;w:close" as an option to that same line.
Personally, I'd like to have ctrl-t/w open and close tabs, respectively, but the only way I've figured how to do that is to add this option: -o CtrlExchangeShift=yes. The problem is, that changes all ctrl-shift commands to become ctrl commands. That means ctrl-r no longer searches bash history.
When you run the shortcut and create some tabs, mintty will look like this:

How do you set copy mode from your screenrc?

I want to enter copy-mode by default from screen. Right now, I'm using stuff to start a server. I'd like to then enter copy-mode so I can just use the mouse to scroll up.
I can't just use stuff "Ctrl-a ESC" (even though Ctrl-a ESC entered from the terminal sets screen mode just fine).
Is there a special character for Ctrl-a that I can stuff? (like ^M for a return)
The command I needed was... copy.

Mouse Button Order Gets Reset after Restart

I using KDE 5.13 on KDE Neon. I use Left-handed mouse. But When I restart the computer, It goes back to Right-handed even if Settings still shows Left handed.
I have found the solution as follows:
First, create shell script with following line:
xmodmap -e "pointer = 3 2 1"
You can find the documentation on https://help.ubuntu.com/community/MouseCustomizations
Then add it to Autostart program as follows and make sure You have selected run on as Before session startup

How can I clear the interpreter screen in Dr. Racket IDE?

Just starting into The Little Schemer, and have a very basic Dr. Racket IDE question:
How can I clear the interpreter screen?
How can I set the up arrow to display the previously-typed items (like in Bash) rather than the current behavior of scrolling up the screen?
My searches are coming up blank, possibly because I don't know the technical term for these actions.
Here's how:
Click on the "run" button, as you discovered
Press Esc + p
And this is the relevant page in the documentation.
1 clear interactions window
As you found out, pressing RUN |> starts up a new instance of the selected language, runs everything in the definition window and clears everything you've done in interactions window (repl).
2 get previous entries like in a shell
a) In the Racket IDE you can hold CTRL with arrow keys to get to previously written statements in the interactions window.
b) Racket can be run from terminal too. When in CLI you type racket it starts up the read-eval-print loop with racket loaded and if you enter (require xrepl) as the first statement you have similar to readline capabilities with up-arrow to get previous, CTRL+r to search history and REPL-commands like ,apropos, ,help and so on. It's called eXtended REPL

When using vim or less in gnu screen, quitting vim or less leaves a lingering imprint

On my new Ubuntu system, I start a screen session and edit a file in vim or view it in less. After I quit, the screen doesn't redraw itself, but simply scrolls up to show a command line under all the stuff I was just viewing in vim or less.
How can I change this so that quitting vim will return me to the screen the way it was before I invoked vim?
screen's altscreen (alternate screen) feature is turned off by default.
Add this to your .screenrc:
altscreen on
See: http://www.gnu.org/software/screen/manual/screen.html#Redisplay
This is caused by your termcap for screen being incomplete. (This seems to be a really common problem.) Vim doesn't know the sequence for restoring the screen, so it just leaves it like it was.
You can work around this problem by setting vim's term option (or the TERM environment variable before you start vim) to a terminal that's "screen compatible", like xterm. eg:
TERM=xterm vim
or (in vim):
:set term=xterm
You can set the t_ti and t_te options in vim to the right codes. See :help xterm-screens in vim for more details.