ruanyl / vim-gh-line

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

check current branch #33

Closed gko closed 4 years ago

gko commented 4 years ago

If it's not master then add it to the url

Based on https://github.com/paulirish/git-open behaviour

laixintao commented 4 years ago

I am not sure, when I open a file on GitHub, I want exactly the commit/lines, so I can copy the link share to other people, paste into a PR log.

But if it's a branch, the link could easily be broken.

Maybe we can use a config variable in .vimrc and default to commit link? What do you think?

ruanyl commented 4 years ago

Hey @gko , thanks for the PR, LGTM. But it seems the URL works for Github and Gitlab but not for Bitbucket. I haven't tried Cgit yet.

gko commented 4 years ago

Hi @ruanyl, thanks for the remark.

I rewrote the whole thing. Only cgit left.

I also noticed that bitbucket actually asks a revision besides ref_name which makes no sense. Example: https://bitbucket.org/gorodinskiy/test/src/?at=test%23123 this doesn't work

however this does: https://bitbucket.org/gorodinskiy/test/src/720e03259f40022ee3db10a5ab0314eae220f86b/?at=test%23123

gko commented 4 years ago

all done.

ruanyl commented 4 years ago

@gko the bitbucket URL seems just like this https://bitbucket.org/<user_name>/test/src/test-branch/, like .../src/<branch_name>.

gko commented 4 years ago

@ruanyl fixed.

Although one test case doesn't work: https://bitbucket.org/gorodinskiy/test/src/test%25123%23123%23123%25123 for the branch test%123#123#123%123 but that might be a problem of Bitbucket.

ruanyl commented 4 years ago

@gko Cool! thanks for the PR.