help-bash
[Top][All Lists]
Advanced

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

Re: is there some copy / paste functionality readline thingy ?


From: Chet Ramey
Subject: Re: is there some copy / paste functionality readline thingy ?
Date: Fri, 8 Nov 2024 09:54:06 -0500
User-agent: Mozilla Thunderbird

On 11/7/24 5:52 PM, #!microsuxx wrote:
like , copy cmdline , copy from cursor to back , copy from cursor to front

Readline maintains what it calls a `kill ring' (the concept is decades
old and the terminology originates with emacs), which commands can add to,
and which can be `yanked' into the line at the current cursor position.
This all basically corresponds to cut/copy/paste and a `clipboard'
as you refer to it.

Look at the readline user manual:

https://tiswww.cwru.edu/php/chet/readline/rluserman.html#Commands-For-Killing

So, for example, in emacs mode, ^K^Y is an easy way to `copy' the text
between the cursor and the end of the line into the kill ring: you kill
the text, which deletes it from the line and copies it to the kill ring,
then immediately yank it back into the line. The cursor position does
move. You can do the same thing for the text between the cursor and the
beginning of the line with ^U^Y.

You can use the concept of the region to copy arbitrary sections of the
input line to the kill ring. Set the mark (saved cursor position) using
^@, move the cursor to where you want, and invoke the copy-region-as-kill
readline command (unbound by default) to copy the text between the point
and mark -- the region -- to the kill ring.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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