[英]How can I copy paste from EMACS [terminal mode] to another application without MOUSE?
I use GNU Emacs 25.1.1. 我使用GNU Emacs 25.1.1。 I use it in terminal mode.
我在终端模式下使用它。 In GUI Mode I know how to copy and yank.
在GUI模式中,我知道如何复制和猛拉。 In terminal mode, copying and pasting from another application works but not the usual keybinding.
在终端模式下,从另一个应用程序复制和粘贴工作但不是通常的键绑定。
Usually Cy is for yank inside emacs but in my terminal mode C-Shift-V only works for yanking. 通常Cy用于在emacs中使用,但在我的终端模式下, C-Shift-V仅适用于yanking。
But when I try to copy from emacs to another shell or application it doesn't copy. 但是当我尝试从emacs复制到另一个shell或应用程序时,它不会复制。
I don't want to use mouse for copying and yanking.. Is there any workaround? 我不想使用鼠标进行复制和yanking ..有没有解决方法? What Am I doing Wrong?
我究竟做错了什么?
In "terminal mode", you're not really interacting with emacs. 在“终端模式”中,您并没有真正与emacs交互。 You're interacting with your terminal or terminal emulator.
您正在与终端或终端仿真器进行交互。
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. 当您
copy
并paste
文本时,终端会执行此操作:您将获取终端显示的文本,而不是emacs应用程序中的文本。
That's why you have to use terminal keybindings : Ctrl-Shift-C and Ctrl-Shift-V to copy and paste text. 这就是为什么你必须使用终端键绑定: Ctrl-Shift-C和Ctrl-Shift-V来复制和粘贴文本。
That's also why pasting large text through terminal in emacs is slow : the terminal "get" the text and "redirect" it to emacs. 这也是为什么在emacs中通过终端粘贴大文本的原因很慢:终端“获取”文本并将其“重定向”到emacs。
So, if you want to select, copy and paste text without the mouse, you'll have to configure your terminal. 因此,如果您想在不使用鼠标的情况下选择,复制和粘贴文本,则必须配置终端。
I do this by using shell-command-on-region
along with the command-line pbpaste
/ pbcopy
on my macOS box. 我通过在我的macOS框上使用
shell-command-on-region
以及命令行pbpaste
/ pbcopy
来实现这一点。 Bind it to a key if necessary: 必要时将其绑定到密钥:
(global-set-key "\C-cr" (shell-command-on-region (point) (mark) "pbcopy"))
There are similar command-line programs you can use for Windows ( https://github.com/ghuntley/pasteboard ) and Linux ( xsel
/ xclip
). 您可以在Windows( https://github.com/ghuntley/pasteboard )和Linux(
xsel
/ xclip
)中使用类似的命令行程序。
你可能会想尝试xclip-mode
(可从GNU ELPA),依靠的外部程序( xclip
X11之下, pbcopy
在Mac OS),让Emacs的与你的GUI(对于像赛扬和CK)沟通,即使它里面运行文本终端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.