FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
vim-ruby-conque/plugin/vim-ruby-conque.vim at master · skwp/vim-ruby-conque · GitHub
skwp
/
vim-ruby-conque
Public
Notifications
You must be signed in to change notification settings
Fork
17
Star
59
Code
Issues
10
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
vim-ruby-conque
/
plugin
/
vim-ruby-conque.vim
Copy path
More file actions
More file actions
Latest commit
History
History
History
167 lines (145 loc) · 5.54 KB
Breadcrumbs
vim-ruby-conque
/
plugin
/
vim-ruby-conque.vim
Copy path
File metadata and controls
167 lines (145 loc) · 5.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
"
============================================================================
"
File:
vim-ruby-conque.vim
"
Description:
Run ruby, rspec, rake in ConqueTerm using colorized output
"
Maintainer:
Yan Pritzker <yan@pritzker.ws>
"
Last Change:
December 8, 2011
"
Version:
0.0.1
"
License:
This program is free software. It comes without any warranty,
"
to the extent permitted by applicable law. You can redistribute
"
it and/or modify it under the terms of the Do What The Fuck You
"
Want To Public License, Version 2, as published by Sam Hocevar.
"
See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"
============================================================================
"
Automatically uses 'rspec' if you have rspec2
"
installed, or 'spec' for rspec1. You can override
"
This by setting up your vimrc like this:
"
"
let g:ruby_conque_rspec_runner='spec'
"
function
!
GetRubyConqueRspecCommand
()
if
exists
(
'
g:ruby_conque_rspec_runner
'
)
return
g:
ruby_conque_rspec_runner
else
if
executable
(
'
rspec
'
)
return
'
rspec
'
elseif
executable
(
'
bundle exec rspec
'
)
return
'
bundle exec rspec
'
elseif
executable
(
'
spec
'
)
return
'
spec
'
elseif
executable
(
'
bundle exec spec
'
)
return
'
bundle exec spec
'
endif
endif
endfunction
function
!
GetRubyConqueRspecOptions
()
if
exists
(
'
g:ruby_conque_rspec_options
'
)
return
g:
ruby_conque_rspec_options
else
return
'
--color
'
endif
endfunction
function
!
GetRubyConqueCucumberCommand
()
if
exists
(
'
g:ruby_conque_cucumber_runner
'
)
return
g:
ruby_conque_cucumber_runner
else
if
executable
(
'
cucumber
'
)
return
'
cucumber
'
elseif
executable
(
'
bundle exec cucumber
'
)
return
'
bundle exec cucumber
'
endif
endif
endfunction
"
Always deletes any existing instance prior to runing the next one
function
!
RunSingleConque
(
command
)
"
Close quickfix and location windows that are in the way
:
cclose
:
lclose
call
CloseSingleConque
()
"
Keep track of the last command issued.
let
g:
last_conque_command
=
a:
command
let
g:
single_conque
=
conque_term#open
(
a:
command
, [
'
botright split
'
,
'
res 10
'
])
endfunction
function
!
CloseSingleConque
()
try
if
(
exists
(
"
g:single_conque
"
))
exec
"
bdelete
"
.
g:
single_conque
.buffer_name
endif
catch
endtry
endfunction
function
!
RunRubyCurrentFileConque
()
call
RunSingleConque
(
"
ruby
"
.
bufname
(
'
%
'
))
endfunction
function
!
RunRspecCurrentLineConque
()
call
RunSingleConque
(
GetRubyConqueRspecCommand
() .
"
"
.
bufname
(
'
%
'
) .
"
-l
"
.
line
(
'
.
'
) .
GetRubyConqueRspecOptions
())
endfunction
function
!
RunRspecCurrentFileConque
()
call
RunSingleConque
(
GetRubyConqueRspecCommand
() .
"
"
.
bufname
(
'
%
'
) .
GetRubyConqueRspecOptions
())
endfunction
function
!
RunRspecAllFilesConque
()
call
RunSingleConque
(
g:
ruby_conque_rspec_command
.
"
"
.
"
spec
"
.
GetRubyConqueRspecOptions
())
endfunction
function
!
RunCucumberCurrentLineConque
()
call
RunSingleConque
(
GetRubyConqueCucumberCommand
() .
"
"
.
bufname
(
'
%
'
) .
"
:
"
.
line
(
'
.
'
))
endfunction
function
!
RunCucumberCurrentFileConque
()
call
RunSingleConque
(
GetRubyConqueCucumberCommand
() .
"
"
.
bufname
(
'
%
'
))
endfunction
function
!
RunRakeConque
()
call
RunSingleConque
(
"
rake
"
)
endfunction
function
!
RunLastConqueCommand
()
if
exists
(
"
g:last_conque_command
"
)
call
RunSingleConque
(
g:
last_conque_command
)
else
echo
"
You haven't run a Vim-Ruby-Conque command to repeat.
"
endif
endfunction
"
Requires https://github.com/skwp/vim-spec-finder
function
!
RunRspecRelated
()
call
RunSingleConque
(
GetRubyConqueRspecCommand
() .
"
"
.
RelatedSpec
() .
GetRubyConqueRspecOptions
())
endfunction
"
Get around Conques annoying trapping of input in some kind of strange
"
inputless input mode. Also added q to close the buffer. n and p jump between
"
errors in the output buffer.
function
!
RubyConqueControls
(single_conque)
:
setlocal
nolist
:
map
<buffer>
j
j
:
map
<buffer>
k
k
:
map
<buffer>
q
<C-w>
c
:
map
<silent>
<buffer>
n /^\s\+\d\+)
<CR>
:noh
<CR>
zt
:
map
<silent>
<buffer>
p ?^\s\+\d\+)
<CR>
:noh
<CR>
zt
:
map
<silent>
<buffer>
f /Finished in
<CR>
:noh
<CR>
zt
endfunction
function
!
UseRspec1
()
let
g:
ruby_conque_rspec_runner
=
'
spec
'
echo
"
Now using spec runner (RSpec 1)
"
endfunction
function
!
UseRspec2
()
let
g:
ruby_conque_rspec_runner
=
'
rspec
'
echo
"
Now using rspec runner (RSpec 2)
"
endfunction
call
conque_term#register_function
(
'
after_startup
'
,
'
RubyConqueControls
'
)
command
!
RunRubyCurrentFileConque
call
RunRubyCurrentFileConque
()
command
!
RunRspecCurrentFileConque
call
RunRspecCurrentFileConque
()
command
!
RunRspecCurrentLineConque
call
RunRspecCurrentLineConque
()
command
!
RunCucumberCurrentLineConque
call
RunCucumberCurrentLineConque
()
command
!
RunCucumberCurrentFileConque
call
RunCucumberCurrentFileConque
()
command
!
RunRakeConque
call
RunRakeConque
()
command
!
RunLastConqueCommand
call
RunLastConqueCommand
()
command
!
RunRspecRelated
call
RunRspecRelated
()
command
!
CloseSingleConque
call
CloseSingleConque
()
command
!
Rspec1
call
UseRspec1
()
command
!
Rspec2
call
UseRspec2
()
nmap
<silent>
<Leader>
rcrr
:RunRubyCurrentFileConque
<CR>
nmap
<silent>
<Leader>
rcss
:RunRspecCurrentFileConque
<CR>
nmap
<silent>
<Leader>
rcll
:RunRspecCurrentLineConque
<CR>
nmap
<silent>
<Leader>
rccl
:RunCucumberCurrentLineConque
<CR>
nmap
<silent>
<Leader>
rccc
:RunCucumberCurrentFileConque
<CR>
nmap
<silent>
<Leader>
rcRR
:RunRakeConque
<CR>
nmap
<silent>
<Leader>
rcrl
:RunLastConqueCommand
<CR>
nmap
<silent>
<Leader>
rcrel
:RunRspecRelated
<CR>
nmap
<silent>
<Leader>
rccc
:CloseSingleConque
<CR>
nmap
<silent>
<Leader>
rcr1
:Rspec1
<CR>
nmap
<silent>
<Leader>
rcr2
:Rspec2
<CR>
Back
|
FazBrowse Home
|
New Git URL