From 42072cc349c46db79c0a4411d399a2fe31cfda7e Mon Sep 17 00:00:00 2001 From: Nino Annighofer Date: Wed, 31 Oct 2018 09:06:34 +0000 Subject: [PATCH] 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 --- autoload/rhubarb.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/rhubarb.vim b/autoload/rhubarb.vim index 39492b3..2a1f01f 100644 --- a/autoload/rhubarb.vim +++ b/autoload/rhubarb.vim @@ -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')