ruanyl / vim-gh-line

vim plugin that open the link of current line on github
MIT License
408 stars 37 forks source link

sed command replaces `https:` with `https/` if remote url is using https scheme. #16

Closed ahakanbaba closed 5 years ago

ahakanbaba commented 5 years ago

The sed command looks like this

" 1. Replace the first `:` with `/`.
    " 2. Strip the `git@` part and replace it with `https://`.
    " 3. Strip the `.git` part in the end.
    let sed_cmd = "sed 's\/:\/\\/\/; s\/^[^@]*@\/https:\\/\\/\/; s\/.git$\/\/; '"

If the url is something like this

$ git config --get remote.origin.url
https://github.com/ahakanbaba/delve.git

The resulting open command launched by vim-gh-line looks like this

open https///github.com/ahakanbaba/delve/blob/fc0d40144a9c65aaf9b851b5816d33f4107f0b75/CHANGELOG.md#L1

The

Replace the first : with /. Has replaced the : at the https: scheme of the url and breaks the browser launch.

I think the intention of that was to replace the separator in remotes using the ssh protocol For example

git@gitenterprise.inside-acme.net:acme/repo-check.git

But it breaks https urls.

KostyaEsmukov commented 5 years ago

Yep, I broke this in #14.

I think the intention of that was to replace the separator in remotes using the ssh protocol

Indeed. I didn't want to make the substitutions more complex by adding http remotes support. Apparently http remotes are more popular than I thought!