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

fix(github): load github-issue only when has('python')

This commit is contained in:
wsdjeg 2023-04-15 18:10:01 +08:00
parent 6388258786
commit ce65aaadc8

View File

@ -35,18 +35,18 @@
function! SpaceVim#layers#github#plugins() abort
return [
\ [g:_spacevim_root_dir . 'bundle/github-issues.vim', {'merged' : 0}],
\ [g:_spacevim_root_dir . 'bundle/github-issues.vim', {'merged' : 0, 'if' : has('python')}],
\ [g:_spacevim_root_dir . 'bundle/vim-github-dashboard', {
\ 'merged' : 0,
\ 'if' : has('ruby'),
\ }],
\ ['tyru/open-browser-github.vim', {
\ 'depends': 'open-browser.vim',
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
\ }],
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
\ ['lambdalisue/vim-gista', {'merged' : 0}],
\ ]
\ ['tyru/open-browser-github.vim', {
\ 'depends': 'open-browser.vim',
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
\ }],
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
\ ['lambdalisue/vim-gista', {'merged' : 0}],
\ ]
endfunction
function! SpaceVim#layers#github#config() abort
@ -55,13 +55,13 @@ function! SpaceVim#layers#github#config() abort
\ 'name' : '+VCS/git',
\ })
if !exists('g:_spacevim_mappings_space.g.h')
let g:_spacevim_mappings_space.g.h = {'name' : ''}
endif
let l:h_submenu_name = SpaceVim#layers#isLoaded('git') ? '+GitHub/Hunks' : '+GitHub'
let g:_spacevim_mappings_space.g.h['name'] = l:h_submenu_name
if !exists('g:_spacevim_mappings_space.g.h')
let g:_spacevim_mappings_space.g.h = {'name' : ''}
endif
let l:h_submenu_name = SpaceVim#layers#isLoaded('git') ? '+GitHub/Hunks' : '+GitHub'
let g:_spacevim_mappings_space.g.h['name'] = l:h_submenu_name
let g:_spacevim_mappings_space.g.g = { 'name': '+Gist' }
let g:_spacevim_mappings_space.g.g = { 'name': '+Gist' }
" @todo remove the username
" autoload to set default username
@ -75,8 +75,10 @@ function! SpaceVim#layers#github#config() abort
" provides more powerful completion.
let g:github_issues_no_omni = 1
call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'i'], 'Gissues',
\ 'show issues', 1)
if has('python')
call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'i'], 'Gissues',
\ 'show issues', 1)
endif
"" }}}
if has('ruby')
@ -107,22 +109,22 @@ function! SpaceVim#layers#github#health() abort
endfunction
function! s:update_stared_repo_list() abort
if empty(g:spacevim_github_username)
call SpaceVim#logger#warn('You need to set g:spacevim_github_username')
return 0
endif
let cache_file = expand('~/.data/github' . g:spacevim_github_username)
if filereadable(cache_file)
let repos = json_encode(readfile(cache_file, '')[0])
else
let repos = github#api#users#GetStarred(g:spacevim_github_username)
echom writefile([json_decode(repos)], cache_file, '')
endif
if empty(g:spacevim_github_username)
call SpaceVim#logger#warn('You need to set g:spacevim_github_username')
return 0
endif
let cache_file = expand('~/.data/github' . g:spacevim_github_username)
if filereadable(cache_file)
let repos = json_encode(readfile(cache_file, '')[0])
else
let repos = github#api#users#GetStarred(g:spacevim_github_username)
echom writefile([json_decode(repos)], cache_file, '')
endif
for repo in repos
let description = repo.full_name . repeat(' ', 40 - len(repo.full_name)) . repo.description
let cmd = 'OpenBrowser ' . repo.html_url
call add(g:unite_source_menu_menus.MyStarredrepos.command_candidates, [description,cmd])
endfor
return 1
endf
for repo in repos
let description = repo.full_name . repeat(' ', 40 - len(repo.full_name)) . repo.description
let cmd = 'OpenBrowser ' . repo.html_url
call add(g:unite_source_menu_menus.MyStarredrepos.command_candidates, [description,cmd])
endfor
return 1
endf