vim/curlがhttps://リンクを認識できるようにする

vim/curlがhttps://リンクを認識できるようにする

私は最近vim / vimdiffがリンクを開くことができることを発見しました(curlを使用しているようです)。これは素晴らしい機能です。今日は次のように使いたいです。

vimdiffの依存関係https://raw.github.com/symfony/symfony-standard/v2.0.10/deps

しかし、https://この素晴らしいメカニズムも機能しないようです。このページには認証がなく、https://データ暗号化のみを提供しているようです。 vimにこのプロトコルを認識させるように強制する方法はhttps://

ベストアンサー1

私がコメントで述べたように、これを処理するnetrwプラグインはhttp://そうではありませんhttps://(プラグインコードを見るとわかります)。コードを入力してhttps://作業を開始しました(バグがないことを保証することはできませんが、試してみたいくつかのサイトでは機能します)。私は次のために一対のパッチを作成しました。netrw.vimそしてnetrwPlugin.vim。これを適用する方法は次のとおりです。この時点で、元のバージョンはそのままにし、パッチバージョンはローカル構成に置きます。

  • ~/.vim/autoloadとディレクトリがあることを確認してください~/.vim/plugin
  • ~/.vim/patches/netrw.patchパッチをダウンロードして保存した場所を覚えておいてください(およびにあるとします~/.vim/patches/netrwPlugin.patch)。
cp /usr/share/vim/vimcurrent/autoload/netrw.vim ~/.vim/autoload
cp /usr/share/vim/vimcurrent/plugin/netrwPlugin.vim ~/.vim/plugin
patch ~/.vim/autoload/netrw.vim ~/.vim/patches/netrw.patch
patch ~/.vim/plugin/netrwPlugin.vim ~/.vim/patches/netrwPlugin.patch

これは私のvim 7.3で動作します。あなたのvimでも動作することを願っています。そうでない場合は、これらの変更をガイドとして使用してハッキングできることを確認してください。


貼り付けボックスが消えた場合は、次のようになります。

netrwプラグイン。パッチ

56c56
<  au BufReadCmd   ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(expand("<amatch>"))
---
>  au BufReadCmd   ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://*   exe "silent doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(expand("<amatch>"))

ネットワークパッチ

682c682
<    if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://'
---
>    if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://' && choice !~ '^https://'
835c835
<    elseif     b:netrw_method  == 5
---
>    elseif     b:netrw_method  == 5 || b:netrw_method  == 50
850c850,854
<       exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)
---
>       if b:netrw_method  == 5
>        exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)
>       else 
>        exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("https://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)
>       endif
853c857,861
<       exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)
---
>       if b:netrw_method == 5 
>        exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)
>       else 
>        exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("https://".g:netrw_machine.b:netrw_fname,1)
>       endif
865c873,877
<      exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1)
---
>      if b:netrw_method == 5
>       exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1)
>      else 
>       exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("https://".g:netrw_machine.netrw_html,1)
>      endif
1565a1578
>   let httpsurm = '^https://\([^/]\{-}\)\(/.*\)\=$'
1598a1612,1618
>   " Method#5.5: https://user@hostname/...path-to-file {{{3
>   elseif match(a:choice,httpsurm) == 0
> "   call Decho("https://...")
>    let b:netrw_method = 50
>    let g:netrw_machine= substitute(a:choice,httpsurm,'\1',"")
>    let b:netrw_fname  = substitute(a:choice,httpsurm,'\2',"")
> 
7075c7095
<   if w:netrw_method == 2 || w:netrw_method == 5
---
>   if w:netrw_method == 2 || w:netrw_method == 5 || w:netrw_method == 50

おすすめ記事