mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-24 10:47:07 +08:00
fix(github): load github-issue only when has('python')
This commit is contained in:
parent
6388258786
commit
ce65aaadc8
@ -35,18 +35,18 @@
|
|||||||
|
|
||||||
function! SpaceVim#layers#github#plugins() abort
|
function! SpaceVim#layers#github#plugins() abort
|
||||||
return [
|
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', {
|
\ [g:_spacevim_root_dir . 'bundle/vim-github-dashboard', {
|
||||||
\ 'merged' : 0,
|
\ 'merged' : 0,
|
||||||
\ 'if' : has('ruby'),
|
\ 'if' : has('ruby'),
|
||||||
\ }],
|
\ }],
|
||||||
\ ['tyru/open-browser-github.vim', {
|
\ ['tyru/open-browser-github.vim', {
|
||||||
\ 'depends': 'open-browser.vim',
|
\ 'depends': 'open-browser.vim',
|
||||||
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
|
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
|
||||||
\ }],
|
\ }],
|
||||||
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
|
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
|
||||||
\ ['lambdalisue/vim-gista', {'merged' : 0}],
|
\ ['lambdalisue/vim-gista', {'merged' : 0}],
|
||||||
\ ]
|
\ ]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#github#config() abort
|
function! SpaceVim#layers#github#config() abort
|
||||||
@ -55,13 +55,13 @@ function! SpaceVim#layers#github#config() abort
|
|||||||
\ 'name' : '+VCS/git',
|
\ 'name' : '+VCS/git',
|
||||||
\ })
|
\ })
|
||||||
|
|
||||||
if !exists('g:_spacevim_mappings_space.g.h')
|
if !exists('g:_spacevim_mappings_space.g.h')
|
||||||
let g:_spacevim_mappings_space.g.h = {'name' : ''}
|
let g:_spacevim_mappings_space.g.h = {'name' : ''}
|
||||||
endif
|
endif
|
||||||
let l:h_submenu_name = SpaceVim#layers#isLoaded('git') ? '+GitHub/Hunks' : '+GitHub'
|
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.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
|
" @todo remove the username
|
||||||
" autoload to set default username
|
" autoload to set default username
|
||||||
@ -75,8 +75,10 @@ function! SpaceVim#layers#github#config() abort
|
|||||||
" provides more powerful completion.
|
" provides more powerful completion.
|
||||||
let g:github_issues_no_omni = 1
|
let g:github_issues_no_omni = 1
|
||||||
|
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'i'], 'Gissues',
|
if has('python')
|
||||||
\ 'show issues', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'i'], 'Gissues',
|
||||||
|
\ 'show issues', 1)
|
||||||
|
endif
|
||||||
"" }}}
|
"" }}}
|
||||||
|
|
||||||
if has('ruby')
|
if has('ruby')
|
||||||
@ -107,22 +109,22 @@ function! SpaceVim#layers#github#health() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:update_stared_repo_list() abort
|
function! s:update_stared_repo_list() abort
|
||||||
if empty(g:spacevim_github_username)
|
if empty(g:spacevim_github_username)
|
||||||
call SpaceVim#logger#warn('You need to set g:spacevim_github_username')
|
call SpaceVim#logger#warn('You need to set g:spacevim_github_username')
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
let cache_file = expand('~/.data/github' . g:spacevim_github_username)
|
let cache_file = expand('~/.data/github' . g:spacevim_github_username)
|
||||||
if filereadable(cache_file)
|
if filereadable(cache_file)
|
||||||
let repos = json_encode(readfile(cache_file, '')[0])
|
let repos = json_encode(readfile(cache_file, '')[0])
|
||||||
else
|
else
|
||||||
let repos = github#api#users#GetStarred(g:spacevim_github_username)
|
let repos = github#api#users#GetStarred(g:spacevim_github_username)
|
||||||
echom writefile([json_decode(repos)], cache_file, '')
|
echom writefile([json_decode(repos)], cache_file, '')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for repo in repos
|
for repo in repos
|
||||||
let description = repo.full_name . repeat(' ', 40 - len(repo.full_name)) . repo.description
|
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])
|
call add(g:unite_source_menu_menus.MyStarredrepos.command_candidates, [description,cmd])
|
||||||
endfor
|
endfor
|
||||||
return 1
|
return 1
|
||||||
endf
|
endf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user