Skip to content

Commit c1f9b5a

Browse files
authored
Merge pull request #223 from tsuyoshicho/feature/token-support
Add support direct token setting
2 parents e485c6c + eee7d14 commit c1f9b5a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ Then gist-vim will ask for your password in order to create an access
266266
token. If you have two-factor authentication enabled, gist-vim will also
267267
prompt you to enter the two-factor key you receive.
268268

269+
NOTE:
270+
If you want you can set it directly to `g:github_user` and `g:gist_token`.
271+
269272
Whichever type of authentication you use, your GitHub password will not be
270273
stored, only a OAuth access token produced specifically for gist-vim. The
271274
token is stored in `~/.gist-vim`. If you stop using the plugin, you can

autoload/gist.vim

+3-1
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,9 @@ function! s:GistGetAuthHeader() abort
961961
return printf('basic %s', webapi#base64#b64encode(g:github_user.':'.password))
962962
endif
963963
let auth = ''
964-
if filereadable(s:gist_token_file)
964+
if !empty(get(g:, 'gist_token', $GITHUB_TOKEN))
965+
let auth = 'token ' . get(g:, 'gist_token', $GITHUB_TOKEN)
966+
elseif filereadable(s:gist_token_file)
965967
let str = join(readfile(s:gist_token_file), '')
966968
if type(str) == 1
967969
let auth = str

0 commit comments

Comments
 (0)