用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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值