|
1 | 1 | "============================================================================= |
2 | 2 | " File: gist.vim |
3 | 3 | " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> |
4 | | -" Last Change: 01-Apr-2011. |
| 4 | +" Last Change: 15-Apr-2011. |
5 | 5 | " Version: 4.9 |
6 | 6 | " WebPage: http://github.com/mattn/gist-vim |
7 | 7 | " License: BSD |
|
97 | 97 | " |
98 | 98 | " let g:gist_show_privates = 1 |
99 | 99 | " |
| 100 | +" * if don't you want to copy URL of the post... |
| 101 | +" |
| 102 | +" let g:gist_put_url_to_clipboard_after_post = 0 |
| 103 | +" |
| 104 | +" or if you want to copy URL and add linefeed at the last of URL, |
| 105 | +" |
| 106 | +" let g:gist_put_url_to_clipboard_after_post = 2 |
| 107 | +" |
| 108 | +" default value is 1. |
| 109 | +" |
100 | 110 | " Thanks: |
101 | 111 | " MATSUU Takuto: |
102 | 112 | " removed carriage return |
@@ -392,6 +402,7 @@ function! s:GistUpdate(user, token, content, gistid, gistnm) |
392 | 402 | let location = substitute(location, '^[^:]\+: ', '', '') |
393 | 403 | if len(location) > 0 && location =~ '^\(http\|https\):\/\/gist\.github\.com\/' |
394 | 404 | setlocal nomodified |
| 405 | + redraw |
395 | 406 | echo 'Done: '.location |
396 | 407 | else |
397 | 408 | let message = matchstr(headers, '^Status: ') |
@@ -484,6 +495,7 @@ function! s:GistDelete(user, token, gistid) |
484 | 495 | if len(token) > 0 |
485 | 496 | let res = s:GistGetPage('https://gist.github.com/delete/'.a:gistid, a:user, '_method=delete&authenticity_token='.token, '') |
486 | 497 | if len(res.content) > 0 |
| 498 | + redraw |
487 | 499 | echo 'Done: ' |
488 | 500 | else |
489 | 501 | let message = matchstr(res.header, '^Status: ') |
@@ -579,6 +591,7 @@ function! s:GistPost(user, token, content, private) |
579 | 591 | let location = matchstr(headers, '^Location: ') |
580 | 592 | let location = substitute(location, '^[^:]\+: ', '', '') |
581 | 593 | if len(location) > 0 && location =~ '^\(http\|https\):\/\/gist\.github\.com\/' |
| 594 | + redraw |
582 | 595 | echo 'Done: '.location |
583 | 596 | else |
584 | 597 | let message = matchstr(headers, '^Status: ') |
@@ -641,6 +654,7 @@ function! s:GistPostBuffers(user, token, private) |
641 | 654 | let res = matchstr(split(res, '\(\r\?\n\|\r\n\?\)'), '^Location: ') |
642 | 655 | let res = substitute(res, '^.*: ', '', '') |
643 | 656 | if len(res) > 0 && res =~ '^\(http\|https\):\/\/gist\.github\.com\/' |
| 657 | + redraw |
644 | 658 | echo 'Done: '.res |
645 | 659 | else |
646 | 660 | echoerr 'Post failed' |
@@ -784,9 +798,12 @@ function! Gist(line1, line2, ...) |
784 | 798 | call system(cmd) |
785 | 799 | endif |
786 | 800 | endif |
787 | | - if g:gist_put_url_to_clipboard_after_post == 1 |
| 801 | + if g:gist_put_url_to_clipboard_after_post > 0 |
| 802 | + if g:gist_put_url_to_clipboard_after_post == 2 |
| 803 | + let url = url . "\n" |
| 804 | + endif |
788 | 805 | if exists('g:gist_clip_command') |
789 | | - call system('echo '.url.' | '.g:gist_clip_command) |
| 806 | + call system(g:gist_clip_command, url) |
790 | 807 | elseif has('unix') && !has('xterm_clipboard') |
791 | 808 | let @" = url |
792 | 809 | else |
|
0 commit comments