Skip to content

Commit dfea06d

Browse files
committed
feat(summary): misc improvements for custom window
See #67
1 parent 6635a25 commit dfea06d

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

Diff for: autoload/ultest/output.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ augroup END
88

99
augroup UltestOutputMappings
1010
autocmd!
11-
autocmd FileType UltestOutput tnoremap <buffer> q <C-\><C-N><C-W><C-K>
12-
autocmd FileType UltestOutput nnoremap <buffer> q <C-W><C-K>
11+
autocmd FileType UltestOutput tnoremap <buffer> q <C-\><C-N><C-W><C-P>
12+
autocmd FileType UltestOutput nnoremap <buffer> q <C-W><C-P>
1313
augroup END
1414

1515
function! ultest#output#open(test) abort

Diff for: autoload/ultest/summary.vim

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ function! ultest#summary#close() abort
4545
endif
4646
endfunction
4747

48-
function! ultest#summary#toggle() abort
48+
function! ultest#summary#toggle(jump) abort
4949
if s:IsOpen()
5050
call ultest#summary#close()
5151
else
52-
call ultest#summary#open()
52+
if a:jump
53+
call ultest#summary#jumpto()
54+
else
55+
call ultest#summary#open()
56+
end
5357
endif
5458
endfunction
5559

Diff for: doc/ultest.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,12 @@ COMMANDS *ultest-commands*
235235
:UltestStopNearest *:UltestStopNearest*
236236
Stop any running jobs and results for the nearest position
237237

238-
:UltestSummary *:UltestSummary*
239-
Toggle the summary window between open and closed
238+
:UltestSummary[!] *:UltestSummary*
239+
Toggle the summary window between open and closed If [!] is given, jump to
240+
the window if opened
240241

241-
:UltestSummaryOpen *:UltestSummaryOpen*
242-
Open the summary window
242+
:UltestSummaryOpen[!] *:UltestSummaryOpen*
243+
Open the summary window If [!] is given, jump to the window
243244

244245
:UltestSummaryClose *:UltestSummaryClose*
245246
Close the summary window

Diff for: plugin/ultest.vim

+6-4
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,14 @@ command! UltestStop call ultest#stop_file()
332332
command! UltestStopNearest call ultest#stop_nearest()
333333

334334
""
335-
" Toggle the summary window between open and closed
336-
command! UltestSummary call ultest#summary#toggle()
335+
" Toggle the summary window between open and closed.
336+
" If [!] is given, jump to the window if opened
337+
command! -bang UltestSummary call ultest#summary#toggle(expand("<bang>") == "!")
337338

338339
""
339-
" Open the summary window
340-
command! UltestSummaryOpen call ultest#summary#open()
340+
" Open the summary window.
341+
" If [!] is given, jump to the window
342+
command! -bang UltestSummaryOpen call ultest#summary#open(expand("<bang>") == "!")
341343

342344
""
343345
" Close the summary window

0 commit comments

Comments
 (0)