Skip to content

Commit 545ca31

Browse files
committed
Merge branch 'master' of https://github.com/mattn/gist-vim
2 parents 14eead6 + 8a001d3 commit 545ca31

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

README.mkd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ If you want your gist to be private by default:
142142

143143
let g:gist_post_private = 1
144144

145+
If you want your gist to be anonymous by default:
146+
147+
let g:gist_post_anonymous = 1
148+
145149
If you want to manipulate multiple files in a gist:
146150

147151
let g:gist_get_multiplefile = 1
@@ -240,3 +244,5 @@ list of ["Authorized applications" on GitHub's "Account Settings"
240244
page][uas].
241245

242246
[uas]: https://github.com/settings/applications
247+
248+
**Note:** the username is optional if you only send anonymous gists.

autoload/gist.vim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,6 @@ endfunction
660660

661661
function! gist#Gist(count, line1, line2, ...) abort
662662
redraw
663-
if strlen(g:github_user) == 0
664-
echohl ErrorMsg | echomsg "You don't have github account. read ':help gist-vim-setup'." | echohl None
665-
return
666-
endif
667663
let bufname = bufname("%")
668664
" find GistID: in content , then we should just update
669665
let gistid = ''
@@ -675,10 +671,14 @@ function! gist#Gist(count, line1, line2, ...) abort
675671
let clipboard = 0
676672
let deletepost = 0
677673
let editpost = 0
678-
let anonymous = 0
674+
let anonymous = get(g:, 'gist_post_anonymous', 0)
679675
let openbrowser = 0
680676
let listmx = '^\%(-l\|--list\)\s*\([^\s]\+\)\?$'
681677
let bufnamemx = '^' . s:bufprefix .'\(\zs[0-9a-f]\+\ze\|\zs[0-9a-f]\+\ze[/\\].*\)$'
678+
if strlen(g:github_user) == 0 && anonymous == 0
679+
echohl ErrorMsg | echomsg "You don't have github account. read ':help gist-vim-setup'." | echohl None
680+
return
681+
endif
682682
if bufname =~ bufnamemx
683683
let gistidbuf = matchstr(bufname, bufnamemx)
684684
elseif exists('b:gist') && has_key(b:gist, 'id')

doc/gist-vim.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ If you want to show your private gists with ":Gist -l": >
150150
If you want your gist to be private by default: >
151151
152152
let g:gist_post_private = 1
153+
<
154+
If you want your gist to be anonymous by default: >
153155
156+
let g:gist_post_anonymous = 1
154157
<
155158
If you want to edit all files for gists containing more than one: >
156159
@@ -270,6 +273,8 @@ Then, add following into your ~/.vimrc
270273
<
271274
This is not secure at all, so strongly discouraged.
272275

276+
NOTE: the username is optional if you only send anonymous gists.
277+
273278
==============================================================================
274279
FAQ *gist-vim-faq*
275280

0 commit comments

Comments
 (0)