~willdurand/srht.vim

825e685f75464cbd41a5f8eded974e46f416355e — Chinmay Dalal 8 months ago b0934d8 main
move webapi plugin check inside `srht#Paste()`

This patch moves the check for the webapi.vim plugin inside the `srht#Paste()` function.
1 files changed, 12 insertions(+), 11 deletions(-)

M autoload/srht.vim
M autoload/srht.vim => autoload/srht.vim +12 -11
@@ 15,17 15,6 @@ if !executable('curl')
  finish
endif

if globpath(&rtp, 'autoload/webapi/http.vim') ==# ''
  echohl ErrorMsg
  echomsg 'srht.vim requires the ''webapi'' plugin, '
  echomsg 'visit https://github.com/mattn/webapi-vim to install it.'
  echohl None
  finish
else
  " Make sure the webapi plugin works.
  call webapi#json#true()
endif

" Configuration: paste
if !exists('g:srht_paste_default_visibility')
  let g:srht_paste_default_visibility = 'unlisted'


@@ 197,6 186,18 @@ endfunction
function! srht#Paste(...) abort
  redraw

  " Ensure webapi plugin is installed
  if globpath(&rtp, 'autoload/webapi/http.vim') ==# ''
    echohl ErrorMsg
    echomsg 'srht.vim requires the ''webapi'' plugin, '
    echomsg 'visit https://github.com/mattn/webapi-vim to install it.'
    echohl None
    finish
  else
    " Make sure the webapi plugin works.
    call webapi#json#true()
  endif

  let visibility = g:srht_paste_default_visibility
  let paste_sha = ''