mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-06 12:14:26 +08:00
Escape hash-mark in Gbrowse URL
This won't break line-highlighting as discussed here: https://github.com/tpope/vim-rhubarb/pull/20#issuecomment-366482507
This commit is contained in:
committed by
Tim Pope
parent
3a9ddb8ffa
commit
42072cc349
@@ -271,7 +271,8 @@ function! rhubarb#FugitiveUrl(opts, ...) abort
|
||||
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
|
||||
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
|
||||
elseif get(a:opts, 'type', '') ==# 'blob' || a:opts.path =~# '[^/]$'
|
||||
let url = root . '/blob/' . commit . '/' . path
|
||||
let escaped_commit = substitute(commit, '#', '%23', 'g')
|
||||
let url = root . '/blob/' . escaped_commit . '/' . path
|
||||
if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2
|
||||
let url .= '#L' . a:opts.line1
|
||||
elseif get(a:opts, 'line2')
|
||||
|
||||
Reference in New Issue
Block a user