I have configured my emacs to run zsh shell within ansi-term. However, copy/paste no longer works i.e. nothing is getting pasted from kill-ring to the terminal. Changing the TERM to vt100, or eterm doesn't solve the problem.
Would appreciate any ideas or solution.
To provide context I have configured ansi-term as follows:
(global-set-key "\C-x\C-a" '(lambda ()(interactive)(ansi-term "/bin/zsh"))) (global-set-key "\C-x\ a" '(lambda ()(interactive)(ansi-term "/bin/zsh")))
When you copy and paste text, the terminal does it : you're taking the text that the terminal displays and not the text that is in your emacs app. That's why you have to use terminal keybindings : Ctrl-Shift-C and Ctrl-Shift-V to copy and paste text.
To cut the text, press C-w . To copy the text, press M-w . To paste the text, press C-y .
You may want to simply switch between character mode and line mode while using the terminal. C-c C-j will run term-line-mode
, which treats the terminal buffer more like a normal text-buffer in which you can move the cursor and yank text. You can switch back to character mode by running term-char-mode
with C-c C-k.
As described in this lovely blog snippet, there's a function, term-paste
, in term.el
, that does exactly what you want. By default it's bound only to S-insert
but the blog's recommended C-c C-y
seems like a good suggestion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With