用Vim编辑远程文件

使用netrw插件:Netrw supports reading and writing files across networks.
通常使用:
gvim ftp://username@hostname[:port]/full_directory/filename
vim ftp://username@hostname[:port]/full_directory/filename

或者开启vim后Ex命令行:e ftp://username@hostname[:port]/full_directory/filename
虽然能支持多种协议,但Windows下并不是所有的协议系统都有实现,通常用ftp协议打开。

貌似gVim7.1之中已经带有此插件。插件最新版本 2007-06-20,也可以更新下
用vim打开解压后的netrw.vba,执行:so %即可(要求Vim版本在7.0及其以上)。


具体:
description                 STARTING WITH v66, NETRW REQUIRES VIM 7.0

Netrw supports reading and writing files across networks.  One may use urls for filenames or one may use netrw's Nread and Nwrite commands. Netrw as provided here supports remote and local directory browsing, and supports  editing files across the network using a variety of methods.  Please report any bugs to NdrOchip@ScampbellPfamily.AbizM - NOSPAM.

    Example:  vim ftp://user@machine/path

(the following table should be columnar if fixed-width fonts are used in your browser)

    REMOTE EDITING
        :e dav://machine[:port]/path                    uses cadaver
        :e fetch://[user@]machine/path                  uses fetch
        :e ftp://[user@]machine[[:#]port]/path          uses ftp   autodetects <.netrc>
        :e http://[user@]machine/path                   uses http  uses wget
        :e rcp://[user@]machine/path                    uses rcp
        :e rsync://[user@]machine[:port]/path           uses rsync
        :e scp://[user@]machine[[:#]port]/path          uses scp
        :e sftp://[user@]machine/path                   uses sftp

    REMOTE READING
        :Nread ?                                        give help
        :Nread "machine:path"                           uses rcp
        :Nread "machine path"                           uses ftp   with <.netrc>
        :Nread "machine id password path"               uses ftp
        :Nread "dav://machine[:port]/path"              uses cadaver
        :Nread "fetch://[user@]machine/path"            uses fetch
        :Nread "ftp://[user@]machine[[:#]port]/path"    uses ftp   autodetects <.netrc>
        :Nread "http://[user@]machine/path"             uses http  uses wget
        :Nread "rcp://[user@]machine/path"              uses rcp
        :Nread "rsync://[user@]machine[:port]/path"     uses rsync
        :Nread "scp://[user@]machine[[:#]port]/path"    uses scp
        :Nread "sftp://[user@]machine/path"             uses sftp

    REMOTE WRITING
        :Nwrite ?                                       give help
        :Nwrite "machine:path"                          uses rcp
        :Nwrite "machine path"                          uses ftp   with <.netrc>
        :Nwrite "machine id password path"              uses ftp
        :Nwrite "dav://machine[:port]/path"             uses cadaver
        :Nwrite "ftp://[user@]machine[[:#]port]/path"   uses ftp   autodetects <.netrc>
        :Nwrite "rcp://[user@]machine/path"             uses rcp
        :Nwrite "rsync://[user@]machine[:port]/path"    uses rsync
        :Nwrite "scp://[user@]machine[[:#]port]/path"   uses scp
        :Nwrite "sftp://[user@]machine/path"            uses sftp
        http: not supported!

    REMOTE DIRECTORY BROWSING
        :e [protocol]://[user]@hostname/path/
        :Nread [protocol]://[user]@hostname/path/

    LOCAL DIRECTORY BROWSING
        :e /some/path/to/a/directory

没有更多推荐了,返回首页