Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: some way to inherit kill ring in su'd shell?
- X-seq: zsh-users 13698
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh users <zsh-users@xxxxxxxxxx>
- Subject: Re: some way to inherit kill ring in su'd shell?
- Date: Sun, 11 Jan 2009 11:07:48 -0800
- In-reply-to: <m3tz857mkm.fsf@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <18789.30656.261463.382208@xxxxxxxxxxxxxxxxxx> <20090110095231.GA61601@xxxxxxxxxxxxxxxxxxxx> <m33afq97gg.fsf@xxxxxxxxxxxxxx> <20090111025418.GA7272@xxxxxxxxxxxxxxxxxxxx> <m3tz857mkm.fsf@xxxxxxxxxxxxxx>
On Jan 11, 12:57pm, Greg Klanderman wrote:
}
} From within zle, it looks like you can do something like
}
} zle copy-region-as-kill <string>
}
} to populate the cut buffer/kill ring.
}
} But then you have to do that from a user-defined widget again.
Use the zle-line-init widget.
It's hard to export the kill ring because of limitations on the format
of environment variables; they have to be plain strings and there has
to be some character that will work as a delimiter between elements if
you want to treat them as arrays. Since just about anything could be
in the killring, there's not much you can do in the way of a delimiters.
So some variant of Phil's idea:
zle-line-init() {
if [[ $KILLRINGPID != $$ && -f $KILLRINGFILE ]]
then source $KILLRINGFILE
fi
export KILLRINGPID=$$ KILLRINGFILE=$HOME/.zsh-killring-$$
typeset -p CUTBUFFER killring >! $KILLRINGFILE
}
zle -N zle-line-init
Of course this gets you the killring at the time zle starts up, not
after you've been editing the "su" command line itself. For that you
would have to override either accept-line or the various kill widgets.
If you really want to pass the killring to a root shell, you'll also
need a secure location for the KILLRINGFILE to live.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author