我将如何重复tmux发送命令x次数

发布于 2025-01-26 19:48:39 字数 588 浏览 1 评论 0原文

有时,我发现自己在一些反复试验和错误中编码一些功能/逻辑进行编码,从而测试一些思考过程。

如果这是一个简单的功能,我可以点击上升箭头,直到找到开始,点击Enter,进行几行执行相同的操作,直到我碰到要编辑的位置为止。

但是,如果我在我想回到我想和更多游戏的另一个想法之前,我还要其他一些命令并与其他一些事情一起玩,我可能会发现自己反复击中25次,然后进入,然后进入,然后重复,直到我准备编辑。

我这样做是因为我有一个ahha的时刻,我不想重新考虑所有工作,而忘记了我的ahha。

由于我一直在TMUX中,所以我想也许我可以找到某种方式发送按键x X次数。

我发现的是,我可以点击Ctrl+B,然后:发送UP以模拟我的UP Arrow键。

作为一个重型VIM用户,我认为可能也可以像在VIM中一样输入数量。

例如,Ctrl+B :15发送:发送15 UP

没有运气。

我已经使用不同的关键字搜索了它,也没有运气。

我觉得我缺少一些简单而简单的东西,但是目前正在脑部掉落。

如何重复此发送命令x次数?

Sometimes I find myself coding in some repl, writing and debugging some function/logic with a little bit of trial and error, kind of testing some thought process out.

If it's a simple function, I can tap the up arrow until I find the start, hit enter, do the same thing for a few lines until I hit the spot I want to edit.

But if I run a few other commands and play around with a few other things before my mind gets back to the other idea I'd like to play with more, I might find myself hitting up repeatedly, like 25 times, then enter, and repeat, until I'm ready to edit.

I do this because I had a ahha moment and I don't want to have to rethink all that work and forget my ahha.

Since I'm always in tmux, I figured maybe I could find some way of sending keypresses x number of times.

What I found was, I could hit ctrl+b, then :send Up to simulate my up arrow key.

Being a heavy vim user, I figured there might be a way I can enter the quantity as well, like I can in Vim.

For example, Ctrl+b :15 send Up, or :send 15 Up.

No luck.

I've searched for it using different keywords, no luck either.

I feel like I'm missing something simple and easy but am brainfarting it at the moment.

How could I repeat this send command x number of times?

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

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

发布评论

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

评论(1

月亮坠入山谷 2025-02-02 19:48:39

也许是这样?

:in $ in $(seq 1 25)的run-shell';做tmux send-keys“#$ i” enter;完成'

Something like this, perhaps?

:run-shell 'for i in $(seq 1 25); do tmux send-keys "#$i" Enter; done'

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