From ff04324bffd86f9c146cc5fc2c0a2f95a1509643 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 8 Jul 2022 00:23:29 -0400 Subject: [PATCH] Don't use "~" for in-band signaling in :GBrowse API I figured "~" was unlikely to have legitimate uses, but it turns out sourcehut uses it to prefix usernames in all of its URLs. Let's go with a control character instead. Resolves: https://github.com/tpope/vim-fugitive/issues/2021 --- autoload/fugitive.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 068bd2b..754f5be 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -7503,13 +7503,13 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor elseif type ==# 'tree' && !empty(path) let opts.path = s:sub(opts.path, '/\=$', '/') endif - let opts.path = tr(substitute(opts.path, '\~', '%7E', 'g'), '%', '~') - let opts.commit = tr(substitute(opts.commit, '\~', '%7E', 'g'), '%', '~') + let opts.path = tr(opts.path, '%', "\032") + let opts.commit = tr(opts.commit, '%', "\032") for l:.Handler in get(g:, 'fugitive_browse_handlers', []) let l:.url = call(Handler, [copy(opts)]) if type(url) == type('') && url =~# '://' - return s:BrowserOpen(substitute(tr(url, '~', '%'), '\C%7E', '\~', 'g'), a:mods, a:bang) + return s:BrowserOpen(tr(url, "\032", '%'), a:mods, a:bang) endif endfor