1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-26 12:10:32 +08:00
2019-10-04 17:54:34 +08:00

33 lines
727 B
VimL

let s:FILE = SpaceVim#api#import('file')
func! s:paser(file)
let config = readfile(a:file, '')
let rst = {}
for line in config
if line !~ '^#' && !empty(line)
let file = split(line)[0]
let owners = split(line)[1:]
call extend(rst, {file : owners})
endif
endfor
return rst
endf
let s:owners = s:paser('.github/CODEOWNERS')
let g:owners = s:owners
func! SpaceVim#dev#codeowner#open_profile()
let url = 'https://github.com/'
let owners = get(s:owners, s:FILE.unify_path(expand('%'), ':.'), [])
if !empty(owners)
let url = url . owners[0][1:]
exe 'OpenBrowser ' . url
else
echohl WarnMsg
echon 'can not find owner for current file'
echohl None
endif
endf