From 6164828e63d5c2aa060a3ffe412937492b0ae359 Mon Sep 17 00:00:00 2001 From: Jonny Hou Date: Sun, 18 Nov 2018 10:45:19 +0800 Subject: [PATCH] Fix for https://github.com/SpaceVim/SpaceVim/issues/2301. (#2303) Updated for remove username in github layer & doc. --- autoload/SpaceVim/layers/github.vim | 3 ++- docs/layers/github.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/github.vim b/autoload/SpaceVim/layers/github.vim index 0783b154c..723ab01be 100644 --- a/autoload/SpaceVim/layers/github.vim +++ b/autoload/SpaceVim/layers/github.vim @@ -47,7 +47,8 @@ function! SpaceVim#layers#github#config() abort let g:_spacevim_mappings_space.g.g = { 'name': '+Gist' } " @todo remove the username - call SpaceVim#mapping#space#def('nnoremap', ['g', 'g', 'l'], 'Gista list -u wsdjeg', + " autoload to set default username + call SpaceVim#mapping#space#def('nnoremap', ['g', 'g', 'l'], 'Gista list', \ 'list gist', 1) call SpaceVim#mapping#space#def('nnoremap', ['g', 'g', 'p'], 'Gista post', \ 'post selection or current file', 1, 1) diff --git a/docs/layers/github.md b/docs/layers/github.md index e360d0778..df419f833 100644 --- a/docs/layers/github.md +++ b/docs/layers/github.md @@ -10,6 +10,7 @@ description: "This layer provides GitHub integration for SpaceVim" - [Description](#description) - [Install](#install) - [Key bindings](#key-bindings) +- [Extra configuration for GitHub and Gist](#extra-configuration-for-github-and-gist) @@ -38,3 +39,20 @@ To use this configuration layer, add following snippet to your custom configurat | `SPC g h p` | show PRs in browser | | `SPC g g l` | list all gist | | `SPC g g p` | post gist | + +## Extra configuration for GitHub and Gist + +For avoid repeating input the account name and passwrod, you need to add the belowing contennt for auto .SpaceVim.d/autoload/myspacevim.vim [Bootstrap Functions](https://spacevim.org/documentation/#bootstrap-functions). + +```vim +func! myspacevim#before() abort + "other configs + let g:github_dashboard = { 'username': 'yourgithubuser', 'password': $GITHUB_TOKEN } + let g:gista#client#default_username = 'monkeyxite' +endf +``` +Refer [github dashboar](https://github.com/junegunn/vim-github-dashboard), for security concerns you could create a Personal Access Token, export it as an environment variable and use it as a password. +```shell +# in some secure file sourced in your .bashrc, .bash_profile, .zshrc, etc. +export GITHUB_TOKEN="" +```