在 Screen 的命令模式下运行 Sed 到 Screen 的剪贴板
我在 Screen 的剪贴板中有一个副本,其中包含单词 Masi
aften。 我想用 Bond 有效地替换它,以便我直接在 Screen 的命令模式下编辑剪贴板。 我知道我可以将剪贴板保存到 /tmp 并在 Vim 中运行替换,但我想学习 Screen。
我运行时,我的数据在 Screen 的剪贴板中,
Ctrl-A : sed s/Masi/Bond/ | [Screen's clipboard] /// I do not know how to refer to Screen's clipboard by a command other that C-A ]
我得到
unknown command sed
如何您在屏幕的命令模式下对屏幕的剪贴板运行命令吗?
I have a copy in Screen's clipboard which contains the word Masi
aften.
I would like to replace it with Bond effectively such that I edit the clipboard directly in Screen's command-mode. I know that I could save the clipboard to /tmp and run the replacement there in Vim, but I want to learn Screen.
I run as I have my data in Screen's clipboard
Ctrl-A : sed s/Masi/Bond/ | [Screen's clipboard] /// I do not know how to refer to Screen's clipboard by a command other that C-A ]
I get
unknown command sed
How can you run a command to Screen's clipboard in Screen's command mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为屏幕没有任何方式在粘贴缓冲区上运行命令。
一种方法是进行绑定以保存粘贴缓冲区,并在屏幕中打开一个新窗口,运行脚本来修改缓冲区。 然后进行另一个绑定以从磁盘重新加载修改后的缓冲区并粘贴(这可以通过正常的粘贴绑定进行绑定)。
将其添加到 screenrc (更改路径):
在某处创建一个 shell 脚本:
screen 中的“ctrl-a , s”将转储剪贴板并创建一个新窗口以供输入 sed 命令。 “ctrl-a,p”将读取剪贴板并粘贴。 脚本末尾的暂停是为了显示 sed 可能给出的任何错误。
I don't think screen has any way of running commands on the paste buffer.
One way to do it is to make a bind to save the paste buffer and open a new window in screen that runs a script to modify the buffer. Then make another bind to reload the modified buffer from disk and paste (this can be bound over the normal paste bind).
Add this to screenrc (changing paths):
Make a shell script somewhere:
"ctrl-a , s" in screen will dump the clipboard and make a new window for the sed command to be entered. "ctrl-a , p" will read the clipboard and paste. The pause at the end of the script is to show any errors sed might give.