mirror of
https://github.com/amix/vimrc
synced 2025-08-07 06:05:00 +08:00
Updated plugins
This commit is contained in:
@ -1,8 +1,3 @@
|
||||
if !exists("g:go_play_open_browser")
|
||||
let g:go_play_open_browser = 1
|
||||
endif
|
||||
|
||||
|
||||
function! go#play#Share(count, line1, line2) abort
|
||||
if !executable('curl')
|
||||
echohl ErrorMsg | echomsg "vim-go: require 'curl' command" | echohl None
|
||||
@ -13,15 +8,16 @@ function! go#play#Share(count, line1, line2) abort
|
||||
let share_file = tempname()
|
||||
call writefile(split(content, "\n"), share_file, "b")
|
||||
|
||||
let command = "curl -s -X POST https://play.golang.org/share --data-binary '@".share_file."'"
|
||||
let snippet_id = go#util#System(command)
|
||||
let l:cmd = ['curl', '-s', '-X', 'POST', 'https://play.golang.org/share',
|
||||
\ '--data-binary', '@' . l:share_file]
|
||||
let [l:snippet_id, l:err] = go#util#Exec(l:cmd)
|
||||
|
||||
" we can remove the temp file because it's now posted.
|
||||
call delete(share_file)
|
||||
|
||||
if go#util#ShellError() != 0
|
||||
echo 'A error has occurred. Run this command to see what the problem is:'
|
||||
echo command
|
||||
if l:err != 0
|
||||
echom 'A error has occurred. Run this command to see what the problem is:'
|
||||
echom go#util#Shelljoin(l:cmd)
|
||||
return
|
||||
endif
|
||||
|
||||
@ -34,7 +30,7 @@ function! go#play#Share(count, line1, line2) abort
|
||||
let @+ = url
|
||||
endif
|
||||
|
||||
if g:go_play_open_browser != 0
|
||||
if go#config#PlayOpenBrowser()
|
||||
call go#tool#OpenBrowser(url)
|
||||
endif
|
||||
|
||||
|
Reference in New Issue
Block a user