How to kill line in Terminal and yank it into Emacs buffer?

175 views Asked by At

I know I can kill current line text by using Ctrl+k in Terminal(Terminal.app). I want to know how to yank it to Emacs.

For example:

|------+-----------------+--------------|
| step | action          | where        |
|------+-----------------+--------------|
|    1 | Type "ABC"      | Terminal.app |
|    2 | C-a             | Terminal.app |
|    3 | C-k             | Terminal.app |
|    4 | Switch to Emacs |              |
|    5 | C-y             | Emacs        |
|------+-----------------+--------------|

In above example step 5, I just want Emacs paste "ABC" into its emacs-buffer. Help me.

Oh, I forgot to say that I do NOT want to select text by mouse and press Command-c.

1

There are 1 answers

1
justinhj On

There may be a better way but I get a line from the Terminal into emacs using echo and pbcopy like this:

Type your text
> ABCD 
Ctrl-A echo
> echo ABCD
Ctrl-E | pbcopy ENTER
> echo ABCD | pbcopy 

Now you can paste into emacs