如何使用GVIM编辑远程文件? [英] How to use GVIM to edit a remote file?

查看:740
本文介绍了如何使用GVIM编辑远程文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 9.10上使用GVIM。我正在寻找正确的方式来配置GVIM,以便能够通过例如ftp编辑远程文件(HTML,PHP,CSS)。

I use GVIM on Ubuntu 9.10. I'm looking for the right way to configure GVIM to be able to edit remote files (HTML, PHP, CSS) by for exemple ftp.


  • 当我使用:e scp://username@remotehost/./path/to/file i get:处理时检测到错误BufEnter*的自动命令:E472:命令失败。 code>

  • 当我通过Dolphin或Nautilus在远程打开文件时,我无法使用NERDTree的其他文件。


因此,如何使用GVIM编辑远程文件,如在我的localhost?

So how to use GVIM to edit remote files like on my localhost?

推荐答案

我发现通过ssh(通过 sshfs )运行文件系统

I've found running the filesystem over ssh (by means of sshfs) a better option than having the editor handle that stuff or running the editor itself over an ssh tunnel.

因此,您需要

apt-get install sshfs

p>

and then

sshfs remoteuser@remotehost:/remote/path /local/mountpoint

这样就可以编辑远程文件,就像它们在本地文件系统上一样。

And that will let you edit your remote files as if they were on your local file system.

它更平滑你可以添加一行到/ etc / fstab

To make it even smoother you can add a line to /etc/fstab

sshfs#remoteusername@remotehost:/remote/path /local/mountpoint fuse user,noauto

由于某种原因,我发现我必须使用 fusermount -u / local / mountpoint 而不是 umount / local / mountpoint 。也许这只是我的发行版。

For some reason I find that I have to use fusermount -u /local/mountpoint rather then just umount /local/mountpoint when experimenting with this. Maybe that's just my distro.

最近我还注意到,安装用户必须在保险丝 。所以:

Recently I've also noted that the mounting user must be in the fuse group. So:

sudo addgroup <username> fuse

另一个流行的选择当然是运行vim(而不是gvim) a href =http://www.gnu.org/software/screen/ =nofollow noreferrer> GNU屏幕 会话,并通过ssh连接到该会话从哪里你碰巧。代码在一天的工作和在晚上你ssh到你的办公室的电脑,重新连接到你的gnu屏幕会话,并准确地拿起你离开的地方。我使用vim查找更丰富的调色板是我真正从gvim错过的唯一的事情,但实际上可以修复感谢到一个urxvt的分支,这将允许您自定义整个256位置调色板,而不只是调色板的大多数终端模拟器将允许您自定义的16个第一位置。

An other popular option of course, would be to run vim (rather then gvim) inside a GNU Screen session on one machine and connect to that session via ssh from wherever you happen to be. Code along all day at work and in the evening you ssh into your office computer, reattach to your gnu screen session and pick up exactly where you left off. I used find the richer color palette to be the only thing I really missed from gvim when using vim, but that can actually be fixed thanks to a fork of urxvt that will let you customize the entire 256 position color palette, not just the 16 first positions of the palette that most terminal emulators will let you customize.

这篇关于如何使用GVIM编辑远程文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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