ruanyl / vim-gh-line

vim plugin that open the link of current line on github

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't set plugin to use branch name based urls

bgaluszka opened this issue · comments

I'm trying to set plugin to use branch name based urls but I can't. After installing it and configuring g:gh_open_command plugin uses hash based urls. When I try to unset unlet g:gh_use_canonical (vim says it's not set) or try to set it to let g:gh_use_canonical = 0 it still uses hash based urls.

I think the issue is that you set it to 1 by default https://github.com/ruanyl/vim-gh-line/blob/master/plugin/vim-gh-line.vim#L39-L41

if !exists('g:gh_use_canonical')
    let g:gh_use_canonical = 1
endif

and then check if it exists but not it's actual value https://github.com/ruanyl/vim-gh-line/blob/master/plugin/vim-gh-line.vim#L124-L130

if exists('g:gh_use_canonical')
  return system(a:cdDir . 'git rev-parse HEAD')
else
  return system(a:cdDir . 'git rev-parse --abbrev-ref HEAD')
endif

which I think should be

if exists('g:gh_use_canonical') && g:gh_use_canonical > 0 
  return system(a:cdDir . 'git rev-parse HEAD')
else
  return system(a:cdDir . 'git rev-parse --abbrev-ref HEAD')
endif

or something along those lines.

Pull request here #23

@ruanyl This has been fixed by merging #23 right ?
Could we please also close this issue ?