用Vim編輯遠程檔案

來源:互聯網
上載者:User
http://denven.blog.hexun.com/11727196_d.html 使用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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.