From 79c5971c82d44ff40067677236fa3d8880a218be Mon Sep 17 00:00:00 2001 From: nilsboy Date: Wed, 6 May 2020 19:52:30 +0200 Subject: [PATCH 01/14] add option vrc_show_command_in_quickfix and vrc_show_command_in_result_buffer --- doc/vim-rest-console.txt | 17 +++++++++++++++++ ftplugin/rest.vim | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/doc/vim-rest-console.txt b/doc/vim-rest-console.txt index 0b11483..bdf7f15 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,21 @@ 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_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..02e0504 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -640,10 +640,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 +707,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' From 308b197d9e5ae97b8c612512faa373d27207e7e8 Mon Sep 17 00:00:00 2001 From: Nils Boysen Date: Thu, 25 Jun 2020 15:30:19 +0200 Subject: [PATCH 02/14] add g:vrc_curl_timeout option --- doc/vim-rest-console.txt | 8 ++++++++ ftplugin/rest.vim | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/vim-rest-console.txt b/doc/vim-rest-console.txt index bdf7f15..ebf68f4 100644 --- a/doc/vim-rest-console.txt +++ b/doc/vim-rest-console.txt @@ -585,6 +585,14 @@ 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* diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 02e0504..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 From 881e568affe36656ebc8c377ac02a9d23ec33208 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Tue, 18 Aug 2020 17:05:03 -0500 Subject: [PATCH 03/14] Use black hole register when deleting output buffer If we use 'clipboard' to sync `*` or `+` registers after each delete operation, then each time we run a request, all output buffers gets copied to the clipboard --- ftplugin/rest.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 7decc96..53a4f98 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -635,7 +635,7 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) """ Display output in view. setlocal modifiable - silent! normal! ggdG + silent! normal! gg"_dG let output = join(a:outputInfo['outputChunks'], "\n\n") call setline('.', split(substitute(output, '[[:return:]]', '', 'g'), '\v\n')) From 8860064a46848c0bb345852d73059d548aba6021 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Thu, 3 Sep 2020 16:24:34 -0500 Subject: [PATCH 04/14] Change character from where to include response syntax This is to allow more blocks of text in the response. The previous start for body syntax is starting the region from the first empty line to the end of file. This is fine for a response with only two blocks of text, so I'm inserting a special UTF-8 space to start inner syntax from there. Also refresh syntax after pasting a content. --- ftplugin/rest.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 53a4f98..1de6e04 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -686,6 +686,8 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) \ 'g' \) endif + " Character u2001 + call append('$', " ") call append('$', split(formattedBody, '\v\n')) elseif s:GetOpt('vrc_debug', 0) echom "VRC: auto-format error: " . v:shell_error @@ -699,7 +701,8 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) syntax clear try execute "syntax include @vrc_" . fileType . " syntax/" . fileType . ".vim" - execute "syntax region body start=/^$/ end=/\%$/ contains=@vrc_" . fileType + " Character u2001 + execute "syntax region body start=/ / end=/\%$/ contains=@vrc_" . fileType catch endtry endif @@ -707,6 +710,7 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) """ Finalize view. setlocal nomodifiable + execute 'syntax sync fromstart' execute origWin . 'wincmd w' endfunction From 6c7e95ea75832de17c9ecb7119ce693b0c4d136f Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Thu, 28 Oct 2021 16:43:12 -0500 Subject: [PATCH 05/14] feat: use treesitter folding --- ftplugin/rest.vim | 57 +++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 66d4924..5f83e3e 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -615,23 +615,31 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) """ Setup view. let origWin = winnr() - let outputWin = bufwinnr(bufnr(a:tmpBufName)) - if outputWin == -1 - let cmdSplit = 'vsplit' - if s:GetOpt('vrc_horizontal_split', 0) - let cmdSplit = 'split' - endif - - if s:GetOpt('vrc_keepalt', 0) - let cmdSplit = 'keepalt ' . cmdSplit - endif - - """ Create view if not loadded or hidden. - execute 'rightbelow ' . cmdSplit . ' ' . a:tmpBufName + "" Open in new buffer + if s:GetOpt('vrc_new_buffer', 0) + execute 'badd ' . a:tmpBufName + execute 'b ' . a:tmpBufName setlocal buftype=nofile else - """ View already shown, switch to it. - execute outputWin . 'wincmd w' + "" Open in Split Window + let outputWin = bufwinnr(bufnr(a:tmpBufName)) + if outputWin == -1 + let cmdSplit = 'vsplit' + if s:GetOpt('vrc_horizontal_split', 0) + let cmdSplit = 'split' + endif + + if s:GetOpt('vrc_keepalt', 0) + let cmdSplit = 'keepalt ' . cmdSplit + endif + + """ Create view if not loadded or hidden. + execute 'rightbelow ' . cmdSplit . ' ' . a:tmpBufName + setlocal buftype=nofile + else + """ View already shown, switch to it. + execute outputWin . 'wincmd w' + endif endif """ Display output in view. @@ -644,8 +652,10 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) 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' + if s:GetOpt('vrc_open_quickfix', 0) + copen + execute outputWin 'wincmd w' + endif endif endif @@ -690,7 +700,7 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) \) endif " Character u2001 - call append('$', " ") + " call append('$', " ") call append('$', split(formattedBody, '\v\n')) elseif s:GetOpt('vrc_debug', 0) echom "VRC: auto-format error: " . v:shell_error @@ -705,7 +715,7 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) try execute "syntax include @vrc_" . fileType . " syntax/" . fileType . ".vim" " Character u2001 - execute "syntax region body start=/ / end=/\%$/ contains=@vrc_" . fileType + " execute "syntax region body start=/ / end=/\%$/ contains=@vrc_" . fileType catch endtry endif @@ -721,9 +731,12 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) endif """ Finalize view. - setlocal nomodifiable - execute 'syntax sync fromstart' - execute origWin . 'wincmd w' + execute '1delete _' + " WTF: + call timer_start(10, { tid -> execute('normal "_ddu')}) + call timer_start(20, { tid -> execute('normal GzxggzMzr')}) + " call timer_start(50, { tid -> execute('setlocal nomodifiable')}) + call timer_start(100, { tid -> execute(origWin . 'wincmd w')}) endfunction """ From 9ee6af707a216532cc348d5e20862fa6bfa67fbc Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Mon, 22 Nov 2021 13:35:24 -0500 Subject: [PATCH 06/14] chore: disable visual and insert mode mappings --- ftplugin/rest.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 5f83e3e..c8522d1 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -843,9 +843,9 @@ endfunction " function! VrcMap() let triggerKey = s:GetOpt('vrc_trigger', '') - execute 'vnoremap ' . triggerKey . ' :call VrcQuery()' + " execute 'vnoremap ' . triggerKey . ' :call VrcQuery()' execute 'nnoremap ' . triggerKey . ' :call VrcQuery()' - execute 'inoremap ' . triggerKey . ' :call VrcQuery()' + " execute 'inoremap ' . triggerKey . ' :call VrcQuery()' endfunction if s:GetOpt('vrc_set_default_mapping', 1) From 3c5a4230e03d05963897d5ab765fb103b18a9635 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Thu, 24 Mar 2022 18:43:58 -0500 Subject: [PATCH 07/14] fix: send content-type only if request has a body see https://stackoverflow.com/q/5661596 --- ftplugin/rest.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index c8522d1..5472fc4 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -190,11 +190,18 @@ endfunction " " @param int a:start " @param int a:end +" @param bool a:hasBody " @return dict {'header1': 'value1', 'header2': 'value2'} " -function! s:ParseHeaders(start, end) +function! s:ParseHeaders(start, end, hasBody) let contentTypeOpt = s:GetOpt('vrc_header_content_type', 'application/json') - let headers = {'Content-Type': contentTypeOpt} + + let headers = {} + + if a:hasBody + let headers = {'Content-Type': contentTypeOpt} + endif + if (a:end < a:start) return headers endif @@ -272,7 +279,7 @@ function! s:ParseGlobSection() let [hostLine, host] = s:ParseHost(1, lastLine - 1) """ Parse global headers. - let headers = s:ParseHeaders(hostLine + 1, lastLine - 1) + let headers = s:ParseHeaders(hostLine + 1, lastLine - 1, v:false) """ Parse curl options. let curlOpts = s:ParseCurlOpts(hostLine + 1, lastLine - 1) @@ -365,7 +372,8 @@ function! s:ParseRequest(start, resumeFrom, end, globSection) endif """ Parse headers if any and merge with global headers. - let localHeaders = s:ParseHeaders(lineNumHost + 1, lineNumVerb - 1) + let hasBody = !empty(getline(lineNumVerb + 1, lineNumNextVerb - 1)) + let localHeaders = s:ParseHeaders(lineNumHost + 1, lineNumVerb - 1, hasBody) let headers = get(a:globSection, 'headers', {}) call extend(headers, localHeaders) From 94291171091be03d424014b867fe44ffe33c0e2a Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Sat, 9 Apr 2022 13:30:27 -0500 Subject: [PATCH 08/14] fix: fold --- ftplugin/rest.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 5472fc4..b82af67 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -742,7 +742,7 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) execute '1delete _' " WTF: call timer_start(10, { tid -> execute('normal "_ddu')}) - call timer_start(20, { tid -> execute('normal GzxggzMzr')}) + call timer_start(20, { tid -> execute('normal GzxggzMzrzr')}) " call timer_start(50, { tid -> execute('setlocal nomodifiable')}) call timer_start(100, { tid -> execute(origWin . 'wincmd w')}) endfunction From f3698ffd089d18d6f201bc74bfd698d919f64b8d Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Tue, 16 Aug 2022 09:38:59 -0500 Subject: [PATCH 09/14] refactor: expect JSONC for headers --- ftplugin/rest.vim | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index b82af67..6773f6f 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -731,20 +731,31 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) """ 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"') + if (!empty(a:outputInfo['commands']) && includeResponseHeader) + let prefixedList = map(copy(a:outputInfo['commands']), '"REQUEST: " . v:val') call append(0, prefixedList) - call append(1, '') + else + execute '1delete _' endif + else + execute '1delete _' endif """ Finalize view. - execute '1delete _' + if includeResponseHeader + call append(0, '/*') + call append(search('\v^\s*$', 'n')-1, '*/') + endif + " WTF: call timer_start(10, { tid -> execute('normal "_ddu')}) - call timer_start(20, { tid -> execute('normal GzxggzMzrzr')}) - " call timer_start(50, { tid -> execute('setlocal nomodifiable')}) - call timer_start(100, { tid -> execute(origWin . 'wincmd w')}) + if includeResponseHeader + call timer_start(30, { tid -> execute('normal GzxggzMzrzrza')}) + else + call timer_start(30, { tid -> execute('normal GzxggzMzr')}) + endif + call timer_start(150, { tid -> execute('setlocal nomodifiable')}) + call timer_start(250, { tid -> execute(origWin . 'wincmd w')}) endfunction """ From 51fd41a1fe318f79e533c909e2e094ba80fdda80 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Sun, 5 Mar 2023 19:13:57 -0500 Subject: [PATCH 10/14] Fixed curl progress output included in responds From D3faIt:master --- ftplugin/rest.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 6773f6f..ef8123b 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -502,7 +502,7 @@ function! s:GetCurlCommand(request) endif let vrcCurlTimeout = s:GetOpt('vrc_curl_timeout', '1m') return [ - \ 'timeout ' . vrcCurlTimeout . ' curl ' . join(curlArgs) . ' ' . s:Shellescape(a:request.host . a:request.requestPath), + \ 'timeout ' . vrcCurlTimeout . ' curl --silent ' . join(curlArgs) . ' ' . s:Shellescape(a:request.host . a:request.requestPath), \ curlOpts \] endfunction From b35b9e41aa9de72661ebc7e1f4ade9db1adf40a1 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Sun, 5 Mar 2023 19:14:31 -0500 Subject: [PATCH 11/14] Make split dynamic based on columns --- ftplugin/rest.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index ef8123b..fe911c5 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -632,9 +632,14 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) "" Open in Split Window let outputWin = bufwinnr(bufnr(a:tmpBufName)) if outputWin == -1 - let cmdSplit = 'vsplit' if s:GetOpt('vrc_horizontal_split', 0) let cmdSplit = 'split' + else + if &columns <= 120 + let cmdSplit = 'split' + else + let cmdSplit = 'vsplit' + endif endif if s:GetOpt('vrc_keepalt', 0) From bd3a04370fed7d93f6ed64894ccda2cdedee0472 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Tue, 7 Mar 2023 09:25:43 -0500 Subject: [PATCH 12/14] Format help --- doc/vim-rest-console.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/vim-rest-console.txt b/doc/vim-rest-console.txt index ebf68f4..0f18001 100644 --- a/doc/vim-rest-console.txt +++ b/doc/vim-rest-console.txt @@ -27,22 +27,22 @@ CONTENTS *VrcContents* 6. Configuration........................................ |VrcConfiguration| vrc_allow_get_request_body................ |vrc_allow_get_request_body| vrc_auto_format_response_enabled.... |vrc_auto_format_response_enabled| - vrc_auto_format_response_patterns...|vrc_auto_format_response_patterns| - vrc_auto_format_uhex.............................|vrc_auto_format_uhex| + vrc_auto_format_response_patterns.. |vrc_auto_format_response_patterns| + vrc_auto_format_uhex............................ |vrc_auto_format_uhex| vrc_curl_opts.......................................... |vrc_curl_opts| vrc_debug.................................................. |vrc_debug| vrc_elasticsearch_support.................. |vrc_elasticsearch_support| vrc_header_content_type...................... |vrc_header_content_type| - vrc_horizontal_split..... .................... |vrc_horizontal_split| + vrc_horizontal_split............................ |vrc_horizontal_split| vrc_keepalt.............................................. |vrc_keepalt| vrc_output_buffer_name........................ |vrc_output_buffer_name| 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_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_syntax_highlight_response.......... |vrc_syntax_highlight_response| vrc_trigger.............................................. |vrc_trigger| 7. Tips 'n Tricks................................................. |VrcTnt| 7.1 POST Data in Bulk................................. |VrcTntDataBulk| From e610df6377a97ec43a215eea60e91b7e7b49e4b9 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Tue, 7 Mar 2023 09:26:22 -0500 Subject: [PATCH 13/14] Add vrc_flex_columns option --- doc/vim-rest-console.txt | 8 ++++++++ ftplugin/rest.vim | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/vim-rest-console.txt b/doc/vim-rest-console.txt index 0f18001..9bfda23 100644 --- a/doc/vim-rest-console.txt +++ b/doc/vim-rest-console.txt @@ -32,6 +32,7 @@ CONTENTS *VrcContents* vrc_curl_opts.......................................... |vrc_curl_opts| vrc_debug.................................................. |vrc_debug| vrc_elasticsearch_support.................. |vrc_elasticsearch_support| + vrc_flex_columns.................................... |vrc_flex_columns| vrc_header_content_type...................... |vrc_header_content_type| vrc_horizontal_split............................ |vrc_horizontal_split| vrc_keepalt.............................................. |vrc_keepalt| @@ -503,6 +504,13 @@ If enabled, the data of Elasticsearch's `_bulk` API can also be specified directly in the request block instead of indirectly via an external file. It's off by default. +------------------------------------------------------------------------------ +*vrc_flex_columns* + +A number, that decides if the ouptut buffer is a vertical or horizontal +split, if you define |vrc_horizontal_split|, this option doesn't work. +It's 155 by default. + ------------------------------------------------------------------------------ *vrc_header_content_type* diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index fe911c5..1d4957a 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -635,7 +635,7 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) if s:GetOpt('vrc_horizontal_split', 0) let cmdSplit = 'split' else - if &columns <= 120 + if &columns < s:GetOpt('vrc_flex_columns', '155') let cmdSplit = 'split' else let cmdSplit = 'vsplit' From aaf124144c3ce376540ecccdab6dc2c6587d7c63 Mon Sep 17 00:00:00 2001 From: davidsierradz Date: Mon, 17 Jul 2023 18:04:23 -0500 Subject: [PATCH 14/14] Improve folding of response --- ftplugin/rest.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ftplugin/rest.vim b/ftplugin/rest.vim index 1d4957a..fd85503 100644 --- a/ftplugin/rest.vim +++ b/ftplugin/rest.vim @@ -753,14 +753,13 @@ function! s:DisplayOutput(tmpBufName, outputInfo, config) endif " WTF: - call timer_start(10, { tid -> execute('normal "_ddu')}) if includeResponseHeader - call timer_start(30, { tid -> execute('normal GzxggzMzrzrza')}) + call timer_start(10, { tid -> execute('setlocal foldlevel=2 | normal zxggza)jzv')}) else - call timer_start(30, { tid -> execute('normal GzxggzMzr')}) + call timer_start(10, { tid -> execute('setlocal foldlevel=1 | normal zxzr')}) endif - call timer_start(150, { tid -> execute('setlocal nomodifiable')}) - call timer_start(250, { tid -> execute(origWin . 'wincmd w')}) + call timer_start(30, { tid -> execute('setlocal nomodifiable')}) + call timer_start(40, { tid -> execute(origWin . 'wincmd w')}) endfunction """