How to use GVIM to edit a remote file?

前端 未结 10 1596
日久生厌
日久生厌 2021-01-30 03:47

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.

  • When i use :e scp:
10条回答
  •  日久生厌
    2021-01-30 04:01

    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.

    So you need to

    apt-get install sshfs
    

    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.

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

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

    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  fuse
    

    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.

提交回复
热议问题