Skip to content

Support GistURL #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: show full error content and add fixes for latest api spec (remov…
…e public and id)
  • Loading branch information
allex committed Jun 27, 2023
commit 44eb504f1b1ee447f53937664a050a24e09b231a
6 changes: 4 additions & 2 deletions autoload/gist.vim
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,12 @@ func s:fix_eol(content) abort
endfunc

function! s:GistUpdate(content, gistid, gistnm, desc) abort
let gist = { 'id': a:gistid, 'files' : {}, 'description': '','public': function('webapi#json#true') }
let gist = { 'files' : {}, 'description': '' }
if exists('b:gist')
if has_key(b:gist, 'filename') && len(a:gistnm) > 0
let gist.files[b:gist.filename] = { 'content': '', 'filename': b:gist.filename }
let b:gist.filename = a:gistnm
endif
if has_key(b:gist, 'private') && b:gist.private | let gist['public'] = function('webapi#json#false') | endif
if has_key(b:gist, 'description') | let gist['description'] = b:gist.description | endif
if has_key(b:gist, 'filename') | let filename = b:gist.filename | endif
else
Expand Down Expand Up @@ -595,6 +594,9 @@ function! s:GistUpdate(content, gistid, gistnm, desc) abort
redraw | echomsg 'Done: '.loc
else
let loc = ''
if len(res.message) == 0
let res.message = res.content
endif
echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None
endif
return loc
Expand Down