Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions doc/vim-rest-console.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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.
Expand Down
22 changes: 17 additions & 5 deletions ftplugin/rest.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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'
Expand Down