开发者

vim: how can you get netrw to open https links?

开发者 https://www.devze.com 2023-01-31 09:57 出处:网络
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

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

  1. In autoload/netrw.vim, add a new netrw_method number for https, a new pattern in NetRwMethod to match https urls, and a few lines of code just like the http one to set the method and other vars correctly.

  2. 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

  1. In autoload/netrw.vim, modify the httpurm 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.

  2. Hijack the b:netrw_option variable to signal whether http or https is wanted (the fetch method already does something similar).

  3. 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".
0

精彩评论

暂无评论...
验证码 换一张
取 消