@@ -363,13 +363,6 @@ endfunction
363
363
" Parts of gist.vim by Yasuhiro Matsumoto <[email protected] > reused
364
364
" gist.vim available under the BSD license, available at
365
365
" http://github.com/mattn/gist-vim
366
- if ! exists (' g:rust_playpen_url' )
367
- let g: rust_playpen_url = ' https://play.rust-lang.org/'
368
- endif
369
- if ! exists (' g:rust_shortener_url' )
370
- let g: rust_shortener_url = ' https://is.gd/'
371
- endif
372
-
373
366
function ! s: has_webapi ()
374
367
if ! exists (" *webapi#http#post" )
375
368
try
@@ -383,6 +376,17 @@ endfunction
383
376
function ! rust#Play (count , line1, line2, ... ) abort
384
377
redraw
385
378
379
+ if ! exists (' g:rust_playpen_url' )
380
+ let l: rust_playpen_url = ' https://play.rust-lang.org/'
381
+ else
382
+ let l: rust_playpen_url = g: rust_playpen_url
383
+ endif
384
+ if ! exists (' g:rust_shortener_url' )
385
+ let l: rust_shortener_url = ' https://is.gd/'
386
+ else
387
+ let l: rust_shortener_url = g: rust_shortener_url
388
+ endif
389
+
386
390
if ! s: has_webapi ()
387
391
echohl ErrorMsg | echomsg ' :RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None
388
392
return
@@ -399,15 +403,15 @@ function! rust#Play(count, line1, line2, ...) abort
399
403
call setreg (' "' , save_regcont, save_regtype)
400
404
endif
401
405
402
- let body = g : rust_playpen_url ." ?code=" .webapi#http#encodeURI (content)
406
+ let body = l : rust_playpen_url ." ?code=" .webapi#http#encodeURI (content)
403
407
404
408
if strlen (body) > 5000
405
409
echohl ErrorMsg | echomsg ' Buffer too large, max 5000 encoded characters (' .strlen (body).' )' | echohl None
406
410
return
407
411
endif
408
412
409
413
let payload = " format=simple&url=" .webapi#http#encodeURI (body)
410
- let res = webapi#http#post (g : rust_shortener_url .' create.php' , payload, {})
414
+ let res = webapi#http#post (l : rust_shortener_url .' create.php' , payload, {})
411
415
let url = res .content
412
416
redraw | echomsg ' Done: ' .url
413
417
endfunction
0 commit comments