Screen

From Schmid.wiki
Jump to: navigation, search

Contents

Commandline

Important commandline options for 'screen'

attach without detach (multiple simultaneous attachments)

$ screen -x

detach and reattach - create if necessary

$ screen -dR

Standard Hotkeys

C-a n                   next screen
C-a p                   previous screen
C-a ' [title]<CR>       get screen by its title

Regions

Region Hotkeys

C-a S                   split
C-a [tab]               switch region
C-a Q                   this region only
C-a X                   remove this region
C-a :resize +/- number  resize

Copy Mode

Copy mode is a very efficient form of copy-pasting, it may or may not be faster than using the mouse, I am not sure. An example of usage:

  • You want to copy an URL from a browser like w3m into an email. The URL looks like this: http://www.some.thing.edu. You change to the screen containing the webbrowser
  • You copy the URL by something like:
    C-A [ ?some<CR>0<SPACE>$<SPACE>
  • You change to the screen containing the email editor
  • You paste the URL by something like
    C-A ]

Copy Mode Hotkeys

C-a [  enters copy mode
[esc]  exits copy mode
C-a ]  paste
vi-movement in the whole scrollback buffer with h,j,k,l, g,G, C-u,C-d
W      yank Word
Y      yank line
C-a s  Emacs style incremental search forward.
C-r    Emacs style reverse i-search.

Press a before the final space key to toggle in append mode. Thus the contents of the paste buffer will not be overwritten, but is appended to.

c      set the left margin for rectangular yanking
C      set the right margin for rectangular yanking

- see also the screen manual, search for 'Mov'.

Column Yanking

Ctrl+a [ c <space> ... JJ <space>
Ctrl+a [        - copy mode
c <Space>       - column yank from here...
JJ <space>      - ... to here, joining lines with spaces

Example

This is motivated by the output of the Subversion status command. It could for example read like this:

$ svn st
D      original.png
A  +   imageWithHiddenData.png
M      decode2lsbits.rb

Now, I would like to yank the 3 filenames to a svn ci command. How to do it?

Ctrl+a [ ? ori<Enter> <Space> c jj$ JJ <Space> Ctrl+a ]

Not at all complicated ;) - here's a breakdown of the commands

Ctrl+a [        - copy mode
? ori<Enter>    - search backwards for 'ori'
c <Space>       - column yank from here...
jj$             - ...to here
JJ              - join lines with spaces
<Space>         - end yank
Ctrl+a ]        - paste it
Personal tools