about summary refs log tree commit diff stats
path: root/vimrc.vim
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-09-08 00:17:34 -0700
committerKartik Agaram <vc@akkartik.com>2019-09-08 00:17:34 -0700
commit4c131b38139eb989a25c7125502295ae1de2a1ea (patch)
tree792826749dccdadfcf71d575a5503e5108897986 /vimrc.vim
parentac4839899a1336ed4fa3407b6e0c908148fe5d4a (diff)
downloadmu-4c131b38139eb989a25c7125502295ae1de2a1ea.tar.gz
5643
Diffstat (limited to 'vimrc.vim')
-rw-r--r--vimrc.vim14
1 files changed, 5 insertions, 9 deletions
diff --git a/vimrc.vim b/vimrc.vim
index 4cb926d0..ed3e1843 100644
--- a/vimrc.vim
+++ b/vimrc.vim
@@ -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"