support gh: and github: uri shorthands

This commit is contained in:
gmarik 2011-03-10 23:04:24 -06:00
parent dcade75133
commit 3f216f13e4

View File

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