-
-
Save joaopizani/2718397 to your computer and use it in GitHub Desktop.
# the following two lines give a two-line status, with the current window highlighted | |
hardstatus alwayslastline | |
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]' | |
# huge scrollback buffer | |
defscrollback 5000 | |
# no welcome message | |
startup_message off | |
# 256 colors | |
attrcolor b ".I" | |
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' | |
defbce on | |
# mouse tracking allows to switch region focus by clicking | |
mousetrack on | |
# default windows | |
screen -t Shell1 1 bash | |
screen -t Shell2 2 bash | |
screen -t Python 3 python | |
screen -t Media 4 bash | |
select 0 | |
bind c screen 1 # window numbering starts at 1 not 0 | |
bind 0 select 10 | |
# get rid of silly xoff stuff | |
bind s split | |
# layouts | |
layout autosave on | |
layout new one | |
select 1 | |
layout new two | |
select 1 | |
split | |
resize -v +8 | |
focus down | |
select 4 | |
focus up | |
layout new three | |
select 1 | |
split | |
resize -v +7 | |
focus down | |
select 3 | |
split -v | |
resize -h +10 | |
focus right | |
select 4 | |
focus up | |
layout attach one | |
layout select one | |
# navigating regions with Ctrl-arrows | |
bindkey "^[[1;5D" focus left | |
bindkey "^[[1;5C" focus right | |
bindkey "^[[1;5A" focus up | |
bindkey "^[[1;5B" focus down | |
# switch windows with F3 (prev) and F4 (next) | |
bindkey "^[OR" prev | |
bindkey "^[OS" next | |
# switch layouts with Ctrl+F3 (prev layout) and Ctrl+F4 (next) | |
bindkey "^[O1;5R" layout prev | |
bindkey "^[O1;5S" layout next | |
# F2 puts Screen into resize mode. Resize regions using hjkl keys. | |
bindkey "^[OQ" eval "command -c rsz" # enter resize mode | |
# use hjkl keys to resize regions | |
bind -c rsz h eval "resize -h -5" "command -c rsz" | |
bind -c rsz j eval "resize -v -5" "command -c rsz" | |
bind -c rsz k eval "resize -v +5" "command -c rsz" | |
bind -c rsz l eval "resize -h +5" "command -c rsz" | |
# quickly switch between regions using tab and arrows | |
bind -c rsz \t eval "focus" "command -c rsz" # Tab | |
bind -c rsz -k kl eval "focus left" "command -c rsz" # Left | |
bind -c rsz -k kr eval "focus right" "command -c rsz" # Right | |
bind -c rsz -k ku eval "focus up" "command -c rsz" # Up | |
bind -c rsz -k kd eval "focus down" "command -c rsz" # Down |
This rocks!
wow :)
One additional from me:
bind v eval "writebuf" "exec sh -c 'exec xsel -b --display :0 -i < /tmp/screen-exchange'"
C-a v
sets your X clipboard to the content of screens copy buffer.
screen newbie question .
if i stick the following into my .screenrc, what command should i be running to
resize the screen windows ?
i tried F2 and ctrl F2 and tried ctrl A + h etc.
didnt seem to work ?
F2 puts Screen into resize mode. Resize regions using hjkl keys.
bindkey "^[OQ" eval "command -c rsz" # enter resize mode
use hjkl keys to resize regions
bind -c rsz h eval "resize -h -5" "command -c rsz"
bind -c rsz j eval "resize -v -5" "command -c rsz"
bind -c rsz k eval "resize -v +5" "command -c rsz"
bind -c rsz l eval "resize -h +5" "command -c rsz"
Amazing ! You have really increased my Screen productivity with your keyboard shortcuts. Thanks a lot !
Just small addition to "reset" the region sizes with "=" in resize mode:
bind -c rsz = eval "resize =" "command -c rsz"
Been looking for how to bind non-alphanumeric keys, thank you!
Fantastic! A massive thanks for this.
First of all: thank you! As I´m new to this screen-rc-ing, I don´t know why but - some of your keys aren´t working for me. E. g. F2: when pressing F2, it only puts "~" on the shell in first area and makes a sound. [CTRL] + [A] + [F2] on the other hand says "Copy mode aborted" in status bar. What am I doing wrong here?
If i turn use the 'mousetrack on', then select-copy-paste does not work anymore using mouse (without mousetrack=on, the copy paste works). Is there a way to enable both ? I m using putty to ssh to ubuntu 16.04 and using screen on ubuntu with this config.
If i turn use the 'mousetrack on', then select-copy-paste does not work anymore using mouse (without mousetrack=on, the copy paste works). Is there a way to enable both ? I m using putty to ssh to ubuntu 16.04 and using screen on ubuntu with this config.
Hold shift while drag selecting. Hold shift while right clicking to paste
Can someone post a screenshot of how this looks like. Seems my screen doesn't split correctly.
I'm having the same issue as other regarding using the F keys. The screen just flashes and inserts a ~
Can anyone explain how this works?
For the people who are having general problems with some keybindings not working: in almost all cases this happens because the keystrokes that are sent to Screen by your terminal emulator do not match the keystrokes that are bound. Different terminal emulators have different opinions on what the hell should happen when keys are pressed, but there is a way to solve your problems:
Produce the escaped literal keystrokes yourself and bind the just-produced keystrokes to whatever you want.
Example: let's say I wanna bind F2, and want to be sure that I bind the correct keystrokes for the terminal I'm using. So:
- I go to my command-line (wherever), press
Ctrl-V
followed by theF2
key. - The literal (escaped) keystroke will just be put at the cursor position (the terminal does not try to interpret it).
- In my case (mate-terminal) I got
^[OQ
.
- In my case (mate-terminal) I got
- Then just carefully copy-paste only the character sequence just produced, and insert them in the right place that you want to bind.
- Example:
bindkey "^[OQ" eval "command -c rsz"
- Example:
This may need to be re-done whenever you change terminal emulator and things don't match again.
Many thanks! Reading the manual, and then actually trying to figure out how to get stuff to work is always a bit tricky. This saved me a good few hours of frustration.
window numbering starts at 1 not 0
I missed this, where ever this was mentioned, and then wondered why things didn't work!
Thanks a lot!
Amazing configuration man! Thanks a lot! It is helping me a lot to use screen on the iPad with iSH.
This is really great, thanks! Who knew screen
could be so well-configured? XD
Great configuration! Thanks!
I have just find out that lines 68 and 69 (Lines) won't work for me.
Instead of them, I had to conffigure ^[[1;5R and ^[[1;5S keys.
So, it would be:
bindkey "^[[1;5R" layout prev
bindkey "^[[1;5S" layout next
Thanks a lot for the configuration!!!
I also use defutf8 on
in my .screenrc
, helps a lot if you need to work with utf8
Instead of changing the window numbering to start at 1 I added
bind ` select 0
That key is left of 1 on my keyboard and allows Keyboard position to match the tabs in screen.
@fevisera Tip: it's possible to bind F2 without using terminal-specific sequences, e.g. replace
bindkey "^[OQ" eval "command -c rsz" # enter resize mode
with
bindkey -k k2 eval "command -c rsz" # enter resize mode
because k2
is the termcap name for F2, see man termcap or man terminfo.
Every terminal will set its termcap and screen will use it, no need to hardcode the terminal-specific sequence.
Shift-F2 and Ctrl-F2 are less obvious but do exist in termcap/terminfo:
- Shift-F2 is equivalent to F14 (F2 + 12 function keys), so is
F4
in termcap (bindkey -k
) - Ctrl-F2 is equivalent to F26 (F2 + 12 + 12 function keys), so is
FG
in termcap (bindkey -k
)
Ctrl-Shift-F2 is F38 though, I don't know why.
Really like your config file!
Is there a way to move the status windows from bottom to top of the screen?
Thanks!