无法在 Firefox 中从终端启动 Google 来搜索屏幕的剪贴板
问题:有一个键盘快捷键可以在 Screen 的复制模式下从终端到 Firefox 搜索当前选择的内容。
您可以在复制模式下按 enter
将句子复制到 Screen 的剪贴板。 但是,我希望能够按 g
将屏幕的剪贴板作为第一个参数放入下面的命令中:
#!/bin/sh
q=$1
open "http://www.google.com/search?q=$q"
我现在执行相同的操作,通过
- C-a Esc [选择区域] 输入
- C-z [到将当前窗口移开]
- google Ca ]
如何将 Screen 的剪贴板放入命令?
Problem: to have a keyboard shortcut to google a current selection in Screen's copy mode from terminal to Firefox
You can copy the sentence to Screen's clipboard in copy-mode by pressing enter
. However, I want to be able to press g
to put the Screen's clipboard to the command below as the first parameter:
#!/bin/sh
q=$1
open "http://www.google.com/search?q=$q"
I do the same at the moment by
- C-a Esc [select the area] enter
- C-z [to put the current window out of the way]
- google C-a ]
How can you put Screen's clipboard to the command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是某人如何修改其.screenrc 文件以将其与 X 剪贴板同步。 您可以尝试修改它以将所选文本发送到 Firefox 而不是 xsel。
Here's a description of how someone modified their .screenrc file to sync it with the X clipboard. You might try modifying it to send the selected text to Firefox instead of xsel.
这适用于 X 的复制缓冲区而不是屏幕的复制缓冲区,但 X 剪贴板通常是您想要的,因为它是通过简单地突出显示文本来设置的。
This works on X's copy buffer rather than Screen's but the X clipboard is usually what you want since it is set by simply highlighting text.
我仍在尝试找出确切的语法,但请看一下在 .screenrc 文件中使用“bind”和“writebuf”(可能还有“eval”)。
编辑
您可以绑定主目录中 .screenrc 文件中的密钥。 例如,
当您在屏幕中使用 g 键时,将运行 eval 命令。 Eval 接受任意数量的参数并将它们作为 Tcl 脚本运行。
writebuf 将屏幕复制/粘贴缓冲区转储到 /tmp/screen-exchange 处的文件中。
第二个字符串以 exec 开头,它将运行 Tcl 解释器外部的程序。 在本例中,我选择 /bin/sh (*nix shell)并传递任意系统命令。 上面的示例复制了 /tmp/screen-exchange 文件,但您可以:
将行添加到 ~/.screenrc 后,重新启动 screen,复制一些文本并尝试
I'm still trying to work out the exact syntax but take a look at using 'bind' with 'writebuf' (and possibly 'eval') within your .screenrc file.
EDIT
You can bind keys in the .screenrc file in your home directory. E.g.,
This runs the eval command when you use the g key in screen. Eval takes any number of arguments and runs them as a Tcl script.
writebuf dumps your screen copy/paste buffer into a file at /tmp/screen-exchange.
The second string starts with exec which will run a program external to the Tcl interpreter. In this case, I choose /bin/sh (a *nix shell) and pass an arbitrary system command. The example above copies the /tmp/screen-exchange file but you might:
Once the line has been added to ~/.screenrc, restart screen, copy some text and try