vim: how can you get netrw to open https links?
In Vim I can open http:
links with gf
. But gf
on https:
links don't seem to work. (Vim just creates a new buffer linked to a long file开发者_JAVA技巧name.) Is there some configuration settting I can tweak to make this work?
No, but feel free to be the one to fix netrw to make it possible! It's probably not all that hard -- on a quick inspection, you would need to modify the autocmd
patterns in plugin/netrwPlugin.vim
to match https://*
, and then either:
Option A
In
autoload/netrw.vim
, add a newnetrw_method
number for https, a new pattern inNetRwMethod
to match https urls, and a few lines of code just like the http one to set the method and other vars correctly.Add code in
NetRead
to deal with the new method number -- possibly by creating a new local variable for the scheme, setting that, and then falling into a common codepath for either http or https.
Option B
In
autoload/netrw.vim
, modify thehttpurm
pattern so that it will match either http or https URLs, and captures the scheme (or at least the "s") so you can tell which is which.Hijack the
b:netrw_option
variable to signal whether http or https is wanted (thefetch
method already does something similar).- Make the
NetRead
http codepath aware of this fact, so that it puts "http" or "https" into the commandline as appropriate instead of being full of hardcoded "http".
精彩评论