diff --git a/doc/vim-rest-console.txt b/doc/vim-rest-console.txt index 0b11483..ebf68f4 100644 --- a/doc/vim-rest-console.txt +++ b/doc/vim-rest-console.txt @@ -39,6 +39,8 @@ CONTENTS *VrcContents* vrc_response_default_content_type.. |vrc_response_default_content_type| vrc_set_default_mapping...................... |vrc_set_default_mapping| vrc_show_command.....................................|vrc_show_command| + vrc_show_command_in_quickfix.............|vrc_show_command_in_quickfix| + vrc_show_command_in_result_buffer...|vrc_show_command_in_result_buffer| vrc_split_request_body........................ |vrc_split_request_body| vrc_syntax_highlight_response...........|vrc_syntax_highlight_response| vrc_trigger.............................................. |vrc_trigger| @@ -576,6 +578,29 @@ pane. It's disabled by default. To enable: let g:vrc_show_command = 1 < ------------------------------------------------------------------------------ +*vrc_show_command_in_quickfix* + +This option disables the printing of the executed curl command in the quickfix +list. It's enabled by default. To disable: +> + let g:vrc_show_command_in_quickfix = 0 + +------------------------------------------------------------------------------ +*vrc_curl_timeout* + +Kill curl after this timeout - default 1m. +See man timeout for details. +> + let g:vrc_curl_timeout = '5s' + +------------------------------------------------------------------------------ +*vrc_show_command_in_result_buffer* + +This option enables the printing of the executed curl command in the output +pane. It's disabled by default. To enable: +> + let g:vrc_show_command_in_result_buffer = 1 +------------------------------------------------------------------------------ *vrc_split_request_body* Determine if the request body should be processed line by line. Default: 0. diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 7decc96..c7a803c 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -492,8 +492,9 @@ function! s:GetCurlCommand(request) if !empty(a:request.dataBody) call add(curlArgs, s:GetCurlDataArgs(a:request)) endif + let vrcCurlTimeout = s:GetOpt('vrc_curl_timeout', '1m') return [ - \ 'curl ' . join(curlArgs) . ' ' . s:Shellescape(a:request.host . a:request.requestPath), + \ 'timeout ' . vrcCurlTimeout . ' curl ' . join(curlArgs) . ' ' . s:Shellescape(a:request.host . a:request.requestPath), \ curlOpts \] endfunction @@ -640,10 +641,12 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) call setline('.', split(substitute(output, '[[:return:]]', '', 'g'), '\v\n')) """ Display commands in quickfix window if any. - if (!empty(a:outputInfo['commands'])) - execute 'cgetexpr' string(a:outputInfo['commands']) - copen - execute outputWin 'wincmd w' + if s:GetOpt('vrc_show_command_in_quickfix', 1) + if (!empty(a:outputInfo['commands'])) + execute 'cgetexpr' string(a:outputInfo['commands']) + copen + execute outputWin 'wincmd w' + endif endif """ Detect content-type based on the returned header. @@ -705,6 +708,15 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) endif endif + """ Display commands in result buffer if any. + if s:GetOpt('vrc_show_command_in_result_buffer', 0) + if (!empty(a:outputInfo['commands'])) + let prefixedList = map(copy(a:outputInfo['commands']), '"REQUEST: " . v:val . "\t"') + call append(0, prefixedList) + call append(1, '') + endif + endif + """ Finalize view. setlocal nomodifiable execute origWin . 'wincmd w'