This commit is contained in:
Kartik Agaram 2019-09-08 00:17:34 -07:00
parent ac4839899a
commit 4c131b3813
1 changed files with 5 additions and 9 deletions

View File

@ -74,7 +74,7 @@ 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
" run test around cursor
" Unfortunately this only works with Linux at the moment.
" Some compiler passes take too long to run in emulated mode.
if empty($TMUX)
@ -83,21 +83,17 @@ if empty($TMUX)
" 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
" known issue:
" can't handle comments at start of current test
noremap <Leader>t {j0:call RunTestMoveCursor("<C-r><C-w>")<CR>
noremap <Leader>t {j0:keeppatterns /[^ #]<CR>:call RunTestMoveCursor("<C-r><C-w>")<CR>
function RunTestMoveCursor(arg)
let l:arg = a:arg == "#" ? " " : a:arg " Vim's '!' insists on interpreting '#' anywhere in its arg
exec "!./run_one_test ".expand("%")." ".l:arg
exec "!./run_one_test ".expand("%")." ".a:arg
exec "normal \<C-o>"
endfunction
else
" we have tmux; we don't need to show any output in the Vim pane so life is simpler
" assume the left-most window is for the shell
noremap <Leader>t {j0:silent! call RunTestInFirstPane("<C-r><C-w>")<CR><C-o>
noremap <Leader>t {j0:keeppatterns /[^ #]<CR>:silent! call RunTestInFirstPane("<C-r><C-w>")<CR><C-o>
function RunTestInFirstPane(arg)
let l:arg = a:arg == "#" ? " " : a:arg " Vim's '!' insists on interpreting '#' anywhere in its arg
call RunInFirstPane("./run_one_test ".expand("%")." ".l:arg)
call RunInFirstPane("./run_one_test ".expand("%")." ".a:arg)
endfunction
function RunInFirstPane(arg)
exec "!tmux select-pane -t :0.0"