|
1 | 1 | "=============================================================================
|
2 | 2 | " File: gist.vim
|
3 | 3 | " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
4 |
| -" Last Change: 18-Sep-2013. |
| 4 | +" Last Change: 07-Oct-2013. |
5 | 5 | " Version: 7.1
|
6 | 6 | " WebPage: http://github.com/mattn/gist-vim
|
7 | 7 | " License: BSD
|
@@ -454,12 +454,15 @@ endfunction
|
454 | 454 | function! s:update_GistID(id)
|
455 | 455 | let view = winsaveview()
|
456 | 456 | normal! gg
|
| 457 | + let ret = 0 |
457 | 458 | if search('\<GistID\>:\s*$')
|
458 | 459 | let line = getline('.')
|
459 | 460 | let line = substitute(line, '\s\+$', '', 'g')
|
460 | 461 | call setline('.', line . ' ' . a:id)
|
| 462 | + let ret = 1 |
461 | 463 | endif
|
462 | 464 | call winrestview(view)
|
| 465 | + return ret |
463 | 466 | endfunction
|
464 | 467 |
|
465 | 468 | " GistPost function:
|
@@ -507,7 +510,9 @@ function! s:GistPost(content, private, desc, anonymous)
|
507 | 510 | \ "description": gist['description'],
|
508 | 511 | \ "private": a:private,
|
509 | 512 | \}
|
510 |
| - call s:update_GistID(b:gist["id"]) |
| 513 | + if s:update_GistID(b:gist["id"]) |
| 514 | + Gist -e |
| 515 | + endif |
511 | 516 | else
|
512 | 517 | let loc = ''
|
513 | 518 | echohl ErrorMsg | echomsg 'Post failed: '. res.message | echohl None
|
@@ -561,7 +566,9 @@ function! s:GistPostBuffers(private, desc, anonymous)
|
561 | 566 | \ "description": gist['description'],
|
562 | 567 | \ "private": a:private,
|
563 | 568 | \}
|
564 |
| - call s:update_GistID(b:gist["id"]) |
| 569 | + if s:update_GistID(b:gist["id"]) |
| 570 | + Gist -e |
| 571 | + endif |
565 | 572 | else
|
566 | 573 | let loc = ''
|
567 | 574 | echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None
|
|
0 commit comments