diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-06-11 23:31:22 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-06-11 23:43:55 -0700 |
commit | fa66b0afa4ec6f6b9fcf8f64649e238d93fee9fd (patch) | |
tree | b33eef12ded63b48601d22d6d0f28296476a93f6 | |
parent | 5ac0786623f5ebd0b3a4f23fb6c23b72e6e277cb (diff) | |
download | mu-fa66b0afa4ec6f6b9fcf8f64649e238d93fee9fd.tar.gz |
only open the trace if test fails
-rw-r--r-- | vimrc.vim | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/vimrc.vim b/vimrc.vim index 66defa34..004d0602 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -77,5 +77,19 @@ endif " the '-a' is because traces can sometimes contain unprintable characters that bother grep command! -nargs=0 L exec "%!grep -a label |grep -v clear-stream:loop" -" run test cursor around cursor, then bring up its trace in a split window -noremap <Leader>t {j0:exec "!run_one_test.sh ".expand("%")." <C-R><C-W>"<CR>:vert split last_run<CR><C-w>p<C-o> +" run test cursor around cursor +" if test fails, open trace in split window +" if test passes, just show output and wait for <CR> +" don't move cursor in original window +" this solution is unfortunate, but seems forced: +" can't put initial cursor movement inside function because we rely on <C-r><C-w> to grab word at cursor +" can't put final cursor movement out of function because that disables the wait for <CR> prompt; function must be final operation of map +" can't avoid the function because that disables the wait for <CR> prompt +noremap <Leader>t {j0:call RunTestMoveCursorAndMaybeOpenTrace("<C-r><C-w>")<CR> +function RunTestMoveCursorAndMaybeOpenTrace(arg) + exec "!run_one_test.sh ".expand("%")." ".a:arg + exec "normal \<C-o>" + if v:shell_error + noautocmd vertical split last_run + endif +endfunction |