[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!