Skip to content

Commit 65735f6

Browse files
author
Greg Lazarev
committed
Support g:rspec_runner and g:rspec_command in GUI vim
This change allows both `g:rspec_runner` and `g:rspec_command` to be used together, which provides a way for GUI vim to run a custom command while providing a specific runner.
1 parent b0d30e2 commit 65735f6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

plugin/rspec.vim

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ if !exists("g:rspec_runner")
44
let g:rspec_runner = "os_x_terminal"
55
endif
66

7-
if !exists("g:rspec_command")
7+
if exists("g:rspec_command")
8+
if has("gui_running") && has("gui_macvim")
9+
let s:rspec_command = "silent !" . s:plugin_path . "/bin/" . g:rspec_runner . " '" . g:rspec_command . "'"
10+
else
11+
let s:rspec_command = g:rspec_command
12+
endif
13+
else
814
let s:cmd = "rspec {spec}"
915

1016
if has("gui_running") && has("gui_macvim")
11-
let g:rspec_command = "silent !" . s:plugin_path . "/bin/" . g:rspec_runner . " '" . s:cmd . "'"
17+
let s:rspec_command = "silent !" . s:plugin_path . "/bin/" . g:rspec_runner . " '" . s:cmd . "'"
1218
elseif has("win32") && fnamemodify(&shell, ':t') ==? "cmd.exe"
13-
let g:rspec_command = "!cls && echo " . s:cmd . " && " . s:cmd
19+
let s:rspec_command = "!cls && echo " . s:cmd . " && " . s:cmd
1420
else
15-
let g:rspec_command = "!clear && echo " . s:cmd . " && " . s:cmd
21+
let s:rspec_command = "!clear && echo " . s:cmd . " && " . s:cmd
1622
endif
1723
endif
1824

@@ -57,5 +63,5 @@ function! SetLastSpecCommand(spec)
5763
endfunction
5864

5965
function! RunSpecs(spec)
60-
execute substitute(g:rspec_command, "{spec}", a:spec, "g")
66+
execute substitute(s:rspec_command, "{spec}", a:spec, "g")
6167
endfunction

0 commit comments

Comments
 (0)