2018-02-04 21:10:41 +08:00
---
title: "SpaceVim github layer"
description: "This layer provides GitHub integration for SpaceVim"
---
2018-06-23 14:37:41 +08:00
# [Available Layers](../) >> github
2018-02-04 21:10:41 +08:00
<!-- vim - markdown - toc GFM -->
- [Description ](#description )
2018-06-23 14:37:41 +08:00
- [Install ](#install )
2018-02-04 21:10:41 +08:00
- [Key bindings ](#key-bindings )
2018-11-18 10:45:19 +08:00
- [Extra configuration for GitHub and Gist ](#extra-configuration-for-github-and-gist )
2018-02-04 21:10:41 +08:00
<!-- vim - markdown - toc -->
## Description
This layer provides GitHub integration for SpaceVim.
2018-06-23 14:37:41 +08:00
## Install
2018-02-04 21:10:41 +08:00
2019-03-04 22:50:38 +08:00
To use this configuration layer, add the following snippet to your custom configuration file.
2018-02-04 21:10:41 +08:00
2018-06-23 14:37:41 +08:00
```toml
[[layers]]
name = "github"
2018-02-04 21:10:41 +08:00
```
## Key bindings
2018-07-14 11:37:00 +08:00
| 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 |
| `SPC g g l` | list all gist |
| `SPC g g p` | post gist |
2018-11-18 10:45:19 +08:00
## Extra configuration for GitHub and Gist
2019-03-04 22:50:38 +08:00
To avoid needing to constantly input your username and password, you'll want to create the following [Bootstrap Function ](https://spacevim.org/documentation/#bootstrap-functions ) in a file such as .SpaceVim.d/autoload/myspacevim.vim.
2018-11-18 10:45:19 +08:00
```vim
func! myspacevim#before() abort
"other configs
let g:github_dashboard = { 'username': 'yourgithubuser', 'password': $GITHUB_TOKEN }
let g:gista#client#default_username = 'monkeyxite'
endf
```
2019-03-04 22:50:38 +08:00
We recommend generating a [personal access token ](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line ) and storing it securely in an environment variable. [Refer to github dashboard ](https://github.com/junegunn/vim-github-dashboard ) for more information.
2018-11-18 10:45:19 +08:00
```shell
# in some secure file sourced in your .bashrc, .bash_profile, .zshrc, etc.
export GITHUB_TOKEN="< your 40 char token > "
```