How to use GVIM to edit a remote file?

前端 未结 10 1591
日久生厌
日久生厌 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:10

    In order for netrw to work seamlessly, I believe you need to not be in compatibility mode.

    Try

    :set nocompatible

    then

    :edit scp://host/path/to/file

    0 讨论(0)
  • 2021-01-30 04:14

    Try this

    :e scp://username@remotehost//path/to/file
    

    Note that the use of // is intentional after remotehost it gives the absolute path of your file :)

    http://www.celsius1414.com/2009/08/19/how-to-edit-remote-files-with-local-vim/

    0 讨论(0)
  • 2021-01-30 04:15

    There is one way and that is using the remote host's copy, using SSH to forward the X11 client to you, like so:

    user@local:~/$ ssh -X user@host
    ...
    user@host:~/$ gvim file
    

    The latter command should open gvim on your desktop. Of course, this relies on the remote host having X11 / gnome / gvim installed in the first place, which might not be the solution you're looking for / an option in your case.

    Note: X11 forwarding can be a security risk.

    0 讨论(0)
  • 2021-01-30 04:15

    About your command, :e scp://username@remotehost/./path/to/file : note that with netrw, scp is taken relative to your home directory on that remote host. To avoid home-relative pathing, drop that "."; ie. :e scp://username@remotehost//path/to/file .

    0 讨论(0)
提交回复
热议问题