fix parsing of GitHub repo paths

GitHub usernames cannot start with an underscore, but they can be a
single character long.
This commit is contained in:
Dmitri Iouchtchenko 2011-05-06 21:03:24 -04:00
parent d661baf4d2
commit 76273c31a1

View File

@ -41,7 +41,7 @@ endf
func! s:parse_name(arg) func! s:parse_name(arg)
let arg = a:arg let arg = a:arg
if arg =~? '^\s*\(gh\|github\):\S\+' if arg =~? '^\s*\(gh\|github\):\S\+'
\ || arg =~? '^\w[a-z0-9-]\+/[^/]\+$' \ || arg =~? '^[a-z0-9][a-z0-9-]*/[^/]\+$'
let uri = 'https://github.com/'.split(arg, ':')[-1] let uri = 'https://github.com/'.split(arg, ':')[-1]
let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i') let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i')
elseif arg =~? '^\s*\(git@\|git://\)\S\+' elseif arg =~? '^\s*\(git@\|git://\)\S\+'