~willdurand/public-inbox

srht.vim: move webapi plugin check inside `srht#Paste()` v1 APPLIED

Chinmay Dalal: 1
 move webapi plugin check inside `srht#Paste()`

 1 files changed, 12 insertions(+), 11 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~willdurand/public-inbox/patches/27962/mbox | git am -3
Learn more about email & git

[PATCH srht.vim] move webapi plugin check inside `srht#Paste()` Export this patch

This patch moves the check for the webapi.vim plugin inside the `srht#Paste()` function.

---
 autoload/srht.vim | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/autoload/srht.vim b/autoload/srht.vim
index 969ea05..b8c0676 100644
--- a/autoload/srht.vim
+++ b/autoload/srht.vim
@@ -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 = ''

-- 
2.34.1
This removes the need for installing webapi-vim just for using `:GBrowse`
Sorry for the delay, applied. Thanks!