1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

Add option for get starred repos

close #590
This commit is contained in:
wsdjeg 2017-06-01 20:59:59 +08:00
parent 1eba32e9a9
commit 76aede0037
5 changed files with 30 additions and 6 deletions

View File

@ -270,6 +270,10 @@ let g:spacevim_enable_os_fileformat_icon = 0
" <
let g:spacevim_plugin_groups = []
""
" Set the github username, It will be used for getting your starred repos, and
" fuzzy find the repo you want.
let g:spacevim_github_username = ''
""
" Disable plugins by name.
" >
" let g:spacevim_disabled_plugins = ['vim-foo', 'vim-bar']

View File

@ -25,6 +25,10 @@ function! SpaceVim#logger#info(msg) abort
endfunction
function! SpaceVim#logger#warn(msg) abort
let msg = s:warpMsg(a:msg, 2)
echohl WarningMsg
echomsg msg
echohl NONE
if g:spacevim_enable_debug && s:logger_level <= 2
call s:wite(s:warpMsg(a:msg, 2))
else

View File

@ -181,14 +181,19 @@ func! Show_Log_for_current_plugin()
exe "nnoremap <buffer><CR> :call <SID>Opencommit('". plug ."', strpart(split(getline('.'),'[33m')[1],0,7))<CR>"
endf
fu! s:Opencommit(repo,commit)
exe "OpenBrowser https://github.com/" . a:repo ."/commit/". a:commit
exe 'OpenBrowser https://github.com/' . a:repo .'/commit/'. a:commit
endf
fu! UpdateStarredRepos()
let repos = github#api#users#GetStarred('wsdjeg')
if empty(g:spacevim_github_username)
call SpaceVim#logger#warn('You need to set g:spacevim_github_username')
return 0
endif
let repos = github#api#users#GetStarred(g:spacevim_github_username)
for repo in repos
let description = repo.full_name . repeat(' ', 40 - len(repo.full_name)) . repo.description
let cmd = "OpenBrowser " . repo.html_url
let cmd = 'OpenBrowser ' . repo.html_url
call add(g:unite_source_menu_menus.MyStarredrepos.command_candidates, [description,cmd])
endfor
return 1
endf

View File

@ -283,9 +283,16 @@ nnoremap <silent><Leader>ta :<C-u>Unite -start-insert -buffer-name=tag tag<cr>
nnoremap <silent><leader>ugg :Unite -silent -start-insert menu:git<CR>
nnoremap <silent><leader>ugf :UniteWithCursorWord file_rec/async<CR>
nnoremap <silent><leader>ugt :UniteWithCursorWord tag<CR>
nnoremap <silent><Leader>ls :Unite
\ -silent -ignorecase -winheight=17
\ -start-insert menu:MyStarredrepos<CR>
nnoremap <silent><Leader>ls :call <SID>view_github_starred_repos()<CR>
function! s:view_github_starred_repos() abort
if empty(g:unite_source_menu_menus.MyStarredrepos.command_candidates)
if UpdateStarredRepos()
Unite -silent -ignorecase -winheight=17 -start-insert menu:MyStarredrepos
endif
else
Unite -silent -ignorecase -winheight=17 -start-insert menu:MyStarredrepos
endif
endfunction
nnoremap <silent><Leader>lm :Unite
\ -silent -ignorecase -winheight=17 -start-insert menu:MpvPlayer<CR>
call zvim#util#loadMusics()

View File

@ -295,6 +295,10 @@ Plugin groups to be loaded.
let g:spacevim_plugin_groups = ['core', 'lang']
<
*g:spacevim_github_username*
Set the github username, It will be used for getting your starred repos, and
fuzzy find the repo you want.
*g:spacevim_disabled_plugins*
Disable plugins by name.
>