150 " Create a quick banner from the current line's text. |
148 " Create a quick banner from the current line's text. |
151 " |
149 " |
152 function! <SID>MakeBanner() |
150 function! <SID>MakeBanner() |
153 let l:banner_text = toupper(join( split( getline('.'), '\zs' ), ' ' )) |
151 let l:banner_text = toupper(join( split( getline('.'), '\zs' ), ' ' )) |
154 let l:banner_text = substitute( l:banner_text, '^\s\+', '', '' ) |
152 let l:banner_text = substitute( l:banner_text, '^\s\+', '', '' ) |
155 let l:sep = repeat( '#', 72 ) |
153 let l:sep = repeat( '#', &textwidth == 0 ? 72 : &textwidth ) |
156 let l:line = line('.') |
154 let l:line = line('.') |
157 |
155 |
158 call setline( l:line, l:sep ) |
156 call setline( l:line, l:sep ) |
159 call append( l:line, [ '### ' . l:banner_text, l:sep ] ) |
157 call append( l:line, [ '### ' . l:banner_text, l:sep ] ) |
|
158 execute 'normal 3==' |
160 call cursor( l:line + 3, 0 ) |
159 call cursor( l:line + 3, 0 ) |
161 endfunction |
160 endfunction |
162 |
161 |
163 |
162 |
164 " }}} |
163 " }}} |
185 " |
184 " |
186 if buflisted( l:buf ) |
185 if buflisted( l:buf ) |
187 execute 'bd! ' . l:buf |
186 execute 'bd! ' . l:buf |
188 endif |
187 endif |
189 |
188 |
190 execute ( exists('g:speckyVertSplit') ? 'vert new ' : 'new ') . l:buf |
189 execute <SID>NewWindowCmd() . l:buf |
191 setlocal buftype=nofile bufhidden=delete noswapfile filetype=specrun |
190 setlocal buftype=nofile bufhidden=delete noswapfile filetype=specrun |
192 set foldtext='--'.getline(v:foldstart).v:folddashes |
191 set foldtext='--'.getline(v:foldstart).v:folddashes |
193 |
192 |
194 " Set up some convenient keybindings. |
193 " Set up some convenient keybindings. |
195 " |
194 " |
228 function! <SID>RunRdoc() |
227 function! <SID>RunRdoc() |
229 |
228 |
230 " If we aren't in a ruby file (specs are ruby-mode too) then we probably |
229 " If we aren't in a ruby file (specs are ruby-mode too) then we probably |
231 " don't care too much about this function. |
230 " don't care too much about this function. |
232 " |
231 " |
233 if ( &ft != 'ruby' && &ft != 'rdoc' ) |
232 if ( &ft != 'ruby' && &ft != 'rdoc' && &ft != 'rspec' ) |
234 call s:err( "Not currently in ruby-mode." ) |
233 call s:err( "Not currently in a rubyish-mode." ) |
235 return |
234 return |
236 endif |
235 endif |
237 |
236 |
238 " Set defaults |
237 " Set defaults |
239 " |
238 " |
264 |
263 |
265 " With multiple matches, strip the comams from the cWORD. |
264 " With multiple matches, strip the comams from the cWORD. |
266 " |
265 " |
267 let l:word = substitute( l:word, ',', '', 'eg' ) |
266 let l:word = substitute( l:word, ',', '', 'eg' ) |
268 |
267 |
269 execute ( exists('g:speckyVertSplit') ? 'vert new ' : 'new ') . l:buf |
268 execute <SID>NewWindowCmd() . l:buf |
270 setlocal buftype=nofile bufhidden=delete noswapfile filetype=rdoc |
269 setlocal buftype=nofile bufhidden=delete noswapfile filetype=rdoc |
271 nnoremap <silent> <buffer> q :close<CR> |
270 nnoremap <silent> <buffer> q :close<CR> |
272 |
271 |
273 " Call the documentation and gather up the output |
272 " Call the documentation and gather up the output |
274 " |
273 " |