Skip to content

Commit dcdf83e

Browse files
committed
Update GistID with Gist -e
1 parent 1aed2e0 commit dcdf83e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

autoload/gist.vim

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"=============================================================================
22
" File: gist.vim
33
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
4-
" Last Change: 18-Sep-2013.
4+
" Last Change: 07-Oct-2013.
55
" Version: 7.1
66
" WebPage: http://github.com/mattn/gist-vim
77
" License: BSD
@@ -454,12 +454,15 @@ endfunction
454454
function! s:update_GistID(id)
455455
let view = winsaveview()
456456
normal! gg
457+
let ret = 0
457458
if search('\<GistID\>:\s*$')
458459
let line = getline('.')
459460
let line = substitute(line, '\s\+$', '', 'g')
460461
call setline('.', line . ' ' . a:id)
462+
let ret = 1
461463
endif
462464
call winrestview(view)
465+
return ret
463466
endfunction
464467

465468
" GistPost function:
@@ -507,7 +510,9 @@ function! s:GistPost(content, private, desc, anonymous)
507510
\ "description": gist['description'],
508511
\ "private": a:private,
509512
\}
510-
call s:update_GistID(b:gist["id"])
513+
if s:update_GistID(b:gist["id"])
514+
Gist -e
515+
endif
511516
else
512517
let loc = ''
513518
echohl ErrorMsg | echomsg 'Post failed: '. res.message | echohl None
@@ -561,7 +566,9 @@ function! s:GistPostBuffers(private, desc, anonymous)
561566
\ "description": gist['description'],
562567
\ "private": a:private,
563568
\}
564-
call s:update_GistID(b:gist["id"])
569+
if s:update_GistID(b:gist["id"])
570+
Gist -e
571+
endif
565572
else
566573
let loc = ''
567574
echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None

0 commit comments

Comments
 (0)