从vim向屏幕窗口发送输入 [英] Sending input to a screen window from vim

查看:133
本文介绍了从vim向屏幕窗口发送输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个vim函数设置,我可以突出显示一行文本,并在clojure中执行。这里是函数:

I have a vim function set up where I can highlight a line of text and execute in clojure. Here's the function:

 function! Clojure_execline()
     let cl = (getline(line(".")))
     // ...
     exec 'clojure -e "' . cl . '"'
 endfunction

这样做的问题是开始很慢,因为它每次都会产生一个新的clojure会话时间我运行它,我不能调用我以前运行的函数。理想情况下,我想要一个隐藏的repl运行,我可以从vim发送输入,并检索输出以及。我学会了gnu屏幕,认为它可以帮助我,但我不知道如何从一个屏幕窗口发送输入到另一个。

The problem with this is that it's slow to start and because it spawns a new clojure session every time I run it, I can't call a function I ran previously. Ideally, I'd like for a hidden repl to be running where I could send input from vim and retrieve the output from as well. I learned about gnu screen and thought it could help me, but I don't know how to send input from one screen window to another.

为了澄清我的问题,这行clojure:

To clarify my problem, take this line of clojure:

(defn add2 [x y] (+ x y))

我想能够在vim中突出显示这一行,并在正在运行的repl中执行。我想能够调用下面的行,并让它执行在同一个repl:

I'd like to be able to highlight this line in vim and execute in a running repl. I want to be able to call the line below and have it execute in the same repl:

(add2 4 5)

之后,我想要能够得到函数的输出。

Afterwards, I'd like to be able to get the output of the function.

基本上,我的问题是,如何将输入从一个屏幕窗口发送到另一个屏幕窗口?

So, basically, my question is, how do I send input from one screen window to another?

推荐答案

找到我在找什么。您可以从终端执行此操作,将字符串直接发送到屏幕窗口的stdin:

Found what I was looking for. You can execute this from a terminal to send a string directly to the stdin of a screen window:

$ screen -X stuff "ls -l\015" # \015 sends a carrige return.

这篇关于从vim向屏幕窗口发送输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆