无法在 Firefox 中从终端启动 Google 来搜索屏幕的剪贴板

发布于 2024-07-22 01:29:14 字数 420 浏览 7 评论 0原文

问题:有一个键盘快捷键可以在 Screen 的复制模式下从终端到 Firefox 搜索当前选择的内容。

您可以在复制模式下按 enter 将句子复制到 Screen 的剪贴板。 但是,我希望能够按 g 将屏幕的剪贴板作为第一个参数放入下面的命令中:

#!/bin/sh
q=$1
open "http://www.google.com/search?q=$q"

我现在执行相同的操作,通过

  1. C-a Esc [选择区域] 输入
  2. C-z [到将当前窗口移开]
  3. 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

  1. C-a Esc [select the area] enter
  2. C-z [to put the current window out of the way]
  3. google C-a ]

How can you put Screen's clipboard to the command?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧伤还要旧人安 2024-07-29 01:29:14

以下是某人如何修改其.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.

沒落の蓅哖 2024-07-29 01:29:14
open "http://www.google.com/search?q=`xclip -o`"

这适用于 X 的复制缓冲区而不是屏幕的复制缓冲区,但 X 剪贴板通常是您想要的,因为它是通过简单地突出显示文本来设置的。

open "http://www.google.com/search?q=`xclip -o`"

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.

记忆里有你的影子 2024-07-29 01:29:14

我仍在尝试找出确切的语法,但请看一下在 .screenrc 文件中使用“bind”和“writebuf”(可能还有“eval”)。

编辑

您可以绑定主目录中 .screenrc 文件中的密钥。 例如,

bind g eval 'writebuf' 'exec . /bin/sh/ -c "cp /tmp/screen-exchange ~/foo.txt"'

当您在屏幕中使用 g 键时,将运行 eval 命令。 Eval 接受任意数量的参数并将它们作为 Tcl 脚本运行。

writebuf 将屏幕复制/粘贴缓冲区转储到 /tmp/screen-exchange 处的文件中。

第二个字符串以 exec 开头,它将运行 Tcl 解释器外部的程序。 在本例中,我选择 /bin/sh (*nix shell)并传递任意系统命令。 上面的示例复制了 /tmp/screen-exchange 文件,但您可以:

open < /tmp/screen-exchange

将行添加到 ~/.screenrc 后,重新启动 screen,复制一些文本并尝试

C-a g

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.,

bind g eval 'writebuf' 'exec . /bin/sh/ -c "cp /tmp/screen-exchange ~/foo.txt"'

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:

open < /tmp/screen-exchange

Once the line has been added to ~/.screenrc, restart screen, copy some text and try

C-a g
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文