tags:

views:

187

answers:

2

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?

+1  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.

Andy
Your question raised a new question. How can you edit the C-a S to be C-a S C-a c?
Masi
Thank you for your answer! -- I get the following text at my Vim when I start terminal: http://dl.getdropbox.com/u/175564/vim.png. Do you know how I can get rid of it?
Masi
+1  A: 

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.

a paid nerd
I am interested in you last hardstatus command. I get the following to my bottomBar: as-fe3dd00-8: 0.33 0.24 0.26 08/05 10:33. The first network. The next which I know is date and clock. What are the others?
Masi
On the right you should see your hostname; the load over the last 1, 5 and 15 minutes per the `uptime` command; and the date and time.I'm not sure offhand how the initial color sequences work, but they're documented in the `screen` man page under "STRING ESCAPES".
a paid nerd
Thank you for your answer!
Masi