[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs key binding

From: Giulio Bottazzi
Subject: Re: emacs key binding
Date: Wed, 28 Mar 2007 10:47:03 +0200

Dear Pieter,
this is not exactly what I had in mind and it's quite different with
respect to emacs behavior (as you said) but it can be very useful
nonetheless! Thanks a lot!


On 3/28/07, Pieter Luteijn <address@hidden> wrote:
Ok, here we really run into a difference in how screen and emacs work, as
there's only one paste buffer in screen that just gets overwritten when
you cut something new. We can probably change the 'cut' action to copy
whatever was in the paste buffer before to some other register, and use
alt-y to cycle through these, but we still have a few little issues:
1) how deep should the queue of old clippings be?
2) the paste-buffer is per-user, the other registers are shared (when you
are using screen -x there can be several users connected), so things can
get mixed up..
3) feedback options are limited, so you might end up not knowing what is
in each register without actually pasting it in, with possible nasty
4) there's not a real scripting language built into screen, so this will
probably be messy to make, and rather easy to break..

For 1, let's just pick a number, say about 10; number 2 we just avoid, by
no longer using the actual paste buffer, for 3, I tried using 'echo' but
if whatever you cut contains quotes it messes that up, but since it is at
the end, that doesn't hurt too much and 4, well better than nothing, I

Here's a first try, it can probably be improved...
# preload registers so we can use them later without getting error messages
register a "<still empty>"
register b "<still empty>"
register c "<still empty>"
register d "<still empty>"
register e "<still empty>"
register f "<still empty>"
register g "<still empty>"
register h "<still empty>"
register i "<still empty>"
register j "<still empty>"
register k "<still empty>"

# ctrl-space -> space to start marking
bindkey -m ^@ stuff " "

# alt-w -> shift queue of past clippings (last one gets
overwritten/dropped) and then send a space to stop marking and copy into
buffer; then copy this to the free'd-up register.
bindkey -m ^[w eval "paste i j" "paste h i" "paste g h" "paste f g" "paste
e f" "paste d e" "paste c d" "paste b c" "paste a b" "stuff ' '" "paste .

# ctrl-y to paste current buffer
bindkey ^y paste a

# alt-y  ->  first save the current register 50 in register 60, then shift
queue of past clippings around, finally put saved register in at freed up
space at the back of the queue.
bindkey ^[y eval "paste a k" "paste b a" "paste c b" "paste d c" "paste e
d" "paste f e" "paste g f" "paste h g" "paste i h" "paste j i" "paste k j"
'register k "echo "' 'paste ka k' 'eval "colon" "paste k" "stuff ^m"'

# bonus
# alt-shift-y -> alt-y in the other direction
bindkey ^[Y eval "paste j k" "paste i j" "paste h i" "paste g h" "paste f
g" "paste e f" "paste d e" "paste c d" "paste b c" "paste a b" "paste k a"
'register k "echo "' 'paste ka k' 'eval "colon" "paste k" "stuff ^m"'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]