TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Bcvi – run vi over a 'back-channel' (2010)

75 点作者 leonry2 个月前

9 条评论

loskutak2 个月前
Nice!<p>I do something like this with WezTerm. When I ssh into a server where I work, I can run<p><pre><code> e some&#x2F;path&#x2F;whatever </code></pre> which just prints a special string containing some control characters, the server hostname and the path. The local wezterm parses it and calls emacsclient with the appropriate TRAMP path. So ssh to server, work there, call `e ~&#x2F;.bashrc` and the remote file immediately opens in my local emacs. This is really useful when I am in some deep directory structure.<p>I use the same mechanism to play remote videos - running `mpv experiment&#x2F;output_foobar.mp4` just prints the special string, which the WezTerm terminal emulator parses and plays the video using my laptop mpv video player. Really really useful for me every day. I run some experiments, can inspect the results immediately. I also have the &quot;reverse scp&quot; which I use from time to time. `rscp foobar.py &#x2F;tmp&#x2F;` causes my laptop to download the foobar.py from the current working directory on the remote server into local &#x2F;tmp&#x2F;.<p>The mechanism is explained here [1] and here [2]<p>The bash function `e` on the server just prints the special string to SetUserVar with name remotemacs and value hostname---path. In wezterm config I have:<p><pre><code> wezterm.on(&#x27;user-var-changed&#x27;, function(win, pane, name, value) if name == &quot;remotemacs&quot; then -- remotemacs:hostname---path local match_start, match_end, hostname, path = string.find(value, &quot;^(.-)[-][-][-](.-)$&quot;) local tramp_path = &quot;&#x2F;ssh:&quot; .. hostname .. &quot;:&quot; .. path wezterm.background_child_process {&#x27;sh&#x27;, &#x27;&#x2F;home&#x2F;loskutak&#x2F;scripts&#x2F;remotemacs&#x27;, tramp_path} </code></pre> [1] <a href="https:&#x2F;&#x2F;wezterm.org&#x2F;config&#x2F;lua&#x2F;window-events&#x2F;user-var-changed.html" rel="nofollow">https:&#x2F;&#x2F;wezterm.org&#x2F;config&#x2F;lua&#x2F;window-events&#x2F;user-var-change...</a><p>[2] <a href="https:&#x2F;&#x2F;wezterm.org&#x2F;recipes&#x2F;passing-data.html" rel="nofollow">https:&#x2F;&#x2F;wezterm.org&#x2F;recipes&#x2F;passing-data.html</a>
cycomanic2 个月前
I was actually looking for something like this 2-3 months ago. Did not find anything and was considering writing my own, but got distracted. Quite cool, I encounter situations where I would like to do this all the time.
darrenf2 个月前
If I’m reading this right, it’s “open a local vi(m) on a remote file”, by invoking a remote command. Is that right?<p>I’m wondering how it’s different in effect to just using<p><pre><code> vim sftp:&#x2F;&#x2F;host&#x2F;path&#x2F;to&#x2F;file</code></pre>
评论 #43285235 未加载
评论 #43285331 未加载
评论 #43285026 未加载
mgarciaisaia2 个月前
I&#x27;d expect the next generation of terminals to do this out of the box when using SSH.<p>I never want to run the server&#x27;s vi[m]&#x2F;emacs&#x2F;nano if I already have my own local one completely set up. I don&#x27;t want to run the remote&#x27;s bash - I have mine already customized! I want to open a new tab in my terminal - and have it connected to the remote, as if I opened a new tab on the server&#x27;s terminal.<p>It&#x27;s the remote&#x27;s files and process tree and resources what I want to interact with - but I&#x27;d rather leverage my local settings as much as possible.
pvg2 个月前
Discussion at the time <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1406145">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1406145</a>
评论 #43284903 未加载
评论 #43284300 未加载
twiclo2 个月前
I prefer sshfs for something like this. Then I can create files the regular way and edit files with my local neovim config.
评论 #43287544 未加载
t-32 个月前
This is pretty cool. I probably don&#x27;t have much real use case for it because this is basically how I already do things when I use nfs or sshfs to bring the work to my local machine while keeping the files remote, but with more work involved.
kazinator2 个月前
This could use forwarding. Has anybody tried to get that working? I mean, you ssh from host A to B, and from B to C. Then from C you bcvi a file such that you&#x27;re editing on A.
zelcon2 个月前
Look at what they need to mimic a fraction of our power (TRAMP)
评论 #43291051 未加载