From 64926ab8a3c8af68a9c5f06d05e7a1e6e26c8a0d Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sun, 23 Feb 2014 10:59:36 -0800 Subject: [PATCH] clear screen as part of the command This is a little faster and it also deals with race conditions when `&t_te` and `t_ti` are doing things like enabling/disabling focus tracking with vitality.vim. --- autoload/vroom.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/autoload/vroom.vim b/autoload/vroom.vim index f36ec7f..1ac7db9 100644 --- a/autoload/vroom.vim +++ b/autoload/vroom.vim @@ -196,12 +196,11 @@ function s:Run(cmd) end endfunction -" Internal: Clear the screen prior to running specs +" Internal: Clear the screen prior to running specs for vimux +" Otherwise, prefix the command with a clear. function s:ClearScreen() if g:vroom_use_vimux call VimuxRunCommand("clear") - else - :silent !clear endif endfunction @@ -238,6 +237,7 @@ function s:SetTestRunnerPrefix(filename) call s:IsUsingBundleExec(a:filename) call s:IsUsingBinstubs() call s:IsUsingSpring() + call s:IsClearScreenEnabled() endfunction " Internal: Check for .zeus.sock and use zeus instead of bundler @@ -291,6 +291,14 @@ function s:IsUsingSpring() endif endfunction +" Internal: Check to see if we should clear the screen and prefixes +" s:test_runner_prefix as neessary +function s:IsClearScreenEnabled() + if g:vroom_clear_screen && !g:vroom_use_vimux + let s:test_runner_prefix = "clear; " . s:test_runner_prefix + endif +endfunction + " Internal: Checks for Gemfile, and sets s:test_runner_prefix as necessary function s:CheckForGemfile() if s:GemfileExists()