用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

展开阅读全文
©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值