From 50a8c2522dbdaaadb32bbe298d3c555ff23786cb Mon Sep 17 00:00:00 2001 From: Seong Yong-ju Date: Sun, 4 Feb 2018 22:10:41 +0900 Subject: [PATCH] Improve github layer Add header into layer file. Add new plugins. * tyru/open-browser-github.vim - open GitHub file/issues/PRs in browser Add key bindings for plugins in github layer. Add README for github layer. --- autoload/SpaceVim/layers/github.vim | 76 ++++++++++++++++++++++++++--- docs/layers/github.md | 38 +++++++++++++++ 2 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 docs/layers/github.md diff --git a/autoload/SpaceVim/layers/github.vim b/autoload/SpaceVim/layers/github.vim index 3ce14453ea4c..83b897057246 100644 --- a/autoload/SpaceVim/layers/github.vim +++ b/autoload/SpaceVim/layers/github.vim @@ -1,11 +1,75 @@ +"============================================================================= +" github.vim --- github layer file for SpaceVim +" Copyright (c) 2018 Shidong Wang & Contributors +" Author: Shidong Wang < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: MIT license +"============================================================================= + +"" +" @section github, layer-github +" @parentsection layers +" This layer provides GitHub integration for SpaceVim +" +" @subsection Mappings +" > +" Mode Key Function +" ------------------------------------------------------------- +" normal SPC g h i show issues +" normal SPC g h a show activities +" normal SPC g h d show dashboard +" normal SPC g h f show current file in browser +" normal SPC g h I show issues in browser +" normal SPC g h p show PRs in browser +" < + function! SpaceVim#layers#github#plugins() abort - return [ - \ ['junegunn/vim-github-dashboard', { 'on_cmd':['GHD','GHA','GHActivity','GHDashboard']}], - \ ['jaxbot/github-issues.vim', { 'on_cmd' : 'Gissues'}], - \ ['wsdjeg/GitHub-api.vim'], - \ ] + return [ + \ ['jaxbot/github-issues.vim', { 'on_cmd' : 'Gissues' }], + \ ['junegunn/vim-github-dashboard', { + \ 'on_cmd': ['GHActivity', 'GHDashboard'], + \ }], + \ ['tyru/open-browser-github.vim', { + \ 'depends': 'open-browser.vim', + \ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'], + \ }], + \ ['wsdjeg/GitHub-api.vim'], + \ ] endfunction function! SpaceVim#layers#github#config() abort - + " TODO Remove duplicated line exists in git layer + let g:_spacevim_mappings_space.g = get(g:_spacevim_mappings_space, 'g', { + \ 'name' : '+VersionControl/git', + \ }) + let g:_spacevim_mappings_space.g.h = { 'name': '+GitHub' } + + "" jaxbot/github-issues.vim {{{ + " Disable completion by github-issues.vim. Because github-complete.vim + " provides more powerful completion. + let g:github_issues_no_omni = 1 + + call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'i'], 'Gissues', + \ 'show issues', 1) + "" }}} + + "" junegunn/vim-github-dashboard {{{ + let g:github_dashboard = { + \ 'username': g:spacevim_github_username, + \ } + + call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'a'], 'GHActivity', + \ 'show activities', 1) + call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'd'], 'GHDashboard', + \ 'show dashboard', 1) + "" }}} + + "" tyru/open-browser-github.vim {{{ + call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'f'], 'OpenGithubFile', + \ 'show current file in browser', 1) + call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'I'], + \ 'OpenGithubIssue', 'show issues in browser', 1) + call SpaceVim#mapping#space#def('nnoremap', ['g', 'h', 'p'], + \ 'OpenGithubPullRequests', 'show PRs in browser', 1) + "" }}} endfunction diff --git a/docs/layers/github.md b/docs/layers/github.md new file mode 100644 index 000000000000..6cc02f18795a --- /dev/null +++ b/docs/layers/github.md @@ -0,0 +1,38 @@ +--- +title: "SpaceVim github layer" +description: "This layer provides GitHub integration for SpaceVim" +--- + +# [SpaceVim Layers:](https://spacevim.org/layers) github + + + +- [Description](#description) +- [Layer Installation](#layer-installation) +- [Key bindings](#key-bindings) + + + +## Description + +This layer provides GitHub integration for SpaceVim. + +## Layer Installation + +To use this configuration layer, add it to your `~/.SpaceVim.d/init.vim`. + +```vim +call SpaceVim#layers#load('github') +``` + +## Key bindings + +| Key Binding | Description | +| ----------- | ------------------------------------ | +| `SPC g h i` | show issues | +| `SPC g h a` | show activities | +| `SPC g h d` | show dashboard | +| `SPC g h f` | show current file in browser | +| `SPC g h I` | show issues in browser | +| `SPC g h p` | show PRs in browser | +