简体   繁体   English

如何在不使用鼠标的情况下将粘贴从EMACS [终端模式]复制到另一个应用程序?

[英]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. 当您copypaste文本时,终端会执行此操作:您将获取终端显示的文本,而不是emacs应用程序中的文本。

That's why you have to use terminal keybindings : Ctrl-Shift-C and Ctrl-Shift-V to copy and paste text. 这就是为什么你必须使用终端键绑定: Ctrl-Shift-CCtrl-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. 因此,如果您想在不使用鼠标的情况下选择,复制和粘贴文本,则必须配置终端。

Here's an example 这是一个例子

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.

相关问题 emacs 终端模式:如何高效复制粘贴 - emacs terminal mode: how to copy and paste efficiently 如何使用Emacs仿真扩展将另一个应用程序中的文本粘贴到Visual Studio中? - How Can I Paste Text From Another Application Into Visual Studio with Emacs Emulation Extension? 无法在Emacs中复制文本并粘贴到另一个应用程序中 - Cannot copy text in Emacs and paste into another application 如何在emacs终端模式下配置simpleclip以与OS互换复制粘贴? - How to configure simpleclip in emacs terminal mode to copy-paste interchangeably with OS? 如何在终端的 Emacs 中滚动鼠标? 我还没有让鼠标滚轮模式工作 - How do I mouse scroll in Emacs in the terminal? I haven't gotten mouse-wheel-mode to work 如何从emacs文档中复制和粘贴文本? - How to copy & paste text from emacs documentation? 如何将文本从一个屏幕会话中的emacs复制到终端中另一屏幕会话中的emacs - How to copy text from emacs in one screen session to emacs in another screen session in terminal 如何将文本从Emacs复制到Linux上的另一个应用程序 - How to copy text from Emacs to another application on Linux 如何在emacs中复制没有源字体锁定的粘贴? - How to copy paste without source font lock in emacs? 如何在不突出显示的情况下将文本从远程emacs复制到本地? - How can I copy the text from remote emacs to the local without hightlighting it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM