# HG changeset patch # User mahlon # Date 1240189026 0 # Node ID 31d00503e03851f748bc05f9572cf6d8a845ca7e # Parent 3346aa8d5364688b66f093ff05dc5201f8c52763 * Small documentation updates * Removed g:speckyVertSplit option if favor of g:speckyWindowType, which also supports opening rDoc and spec output in a tabbed window. The default is now tabbed window -- use 'g:speckyWindowType = 2' to replicate the old behavior. * Support syntax highlighting for 'pending' specs that are implemented and expected to fail, instead of just pendings for 'not implemented yet'. * Allow rdoc lookups from within spec mode. * Add ftplugin for rspec, so rspec files behaviorally act the same as ruby. * Banner creation now respects current indentation level. diff -r 3346aa8d5364 -r 31d00503e038 specky/Makefile --- a/specky/Makefile Fri Apr 03 23:34:00 2009 +0000 +++ b/specky/Makefile Mon Apr 20 00:57:06 2009 +0000 @@ -4,6 +4,7 @@ SOURCE += syntax/specrun.vim SOURCE += syntax/rspec.vim SOURCE += ftdetect/rspec.vim +SOURCE += ftplugin/rspec.vim SOURCE += doc/specky.txt SOURCE += plugin/specky.vim SOURCE += snippets/rspec.snippets diff -r 3346aa8d5364 -r 31d00503e038 specky/doc/specky.txt --- a/specky/doc/specky.txt Fri Apr 03 23:34:00 2009 +0000 +++ b/specky/doc/specky.txt Mon Apr 20 00:57:06 2009 +0000 @@ -21,7 +21,7 @@ 4.5) Run specs for the current buffer.......|g:speckyRunSpecKey| 4.6) Modify the default spec command........|g:speckyRunSpecCmd| 4.7) Modify the default rdoc command........|g:speckyRunRdocCmd| - 4.8) Split windows vertically...............|g:speckyVertSplit| + 4.8) Alter new window behavior..............|g:speckyWindowType| 5) Author.......................................|SpeckyAuthor| 6) License......................................|SpeckyLicense| @@ -92,7 +92,7 @@ let g:speckyRunSpecKey = "s" let g:speckyRunSpecCmd = "spec -fs -r loadpath.rb" let g:speckyRunRdocCmd = "fri -L -f plain" - let g:speckyVertSplit = 1 + let g:speckyWindowType = 2 With these bindings, all specky commands start with ("s" for @@ -201,8 +201,8 @@ aRubyClass.rb ---> aRubyClass_spec.rb~ - Because it leaves respective buffers open, you can essentially think of this - as a quick toggle for code and tests. +Because it leaves respective buffers open, you can essentially think of this +as a quick toggle between code and tests. @@ -210,7 +210,7 @@ 4.5 *g:speckyRunSpecKey* -Setting this variable allows you to run "spec" on the current buffer. +Setting this variable runs "spec" on the current buffer. All output is sent to a syntax highlighted scratch buffer. This new window is re-used for each spec run. You can quickly "jump" to assertion failures and @@ -259,7 +259,7 @@ If you prefer an rdoc display program other than "ri", you can set it -with this variable. +with this variable. "fri -L -f plain" is always a nice choice, for example. Default: ~ ri @@ -267,12 +267,21 @@ ------------------------------------------------------------------------------ -4.8 *g:speckyVertSplit* +4.8 *g:speckyWindowType* -For both spec and rdoc commands, split the new window vertically instead of -horizontally. +For both spec and rdoc commands, this variable controls the behavior of the +newly generated window. + Default: ~ + 0 + + 0 ~ + Create a new tabbed window + 1 ~ + Split the current window horizontally + 2 ~ + Split the current window vertically ============================================================================== diff -r 3346aa8d5364 -r 31d00503e038 specky/ftplugin/rspec.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/specky/ftplugin/rspec.vim Mon Apr 20 00:57:06 2009 +0000 @@ -0,0 +1,7 @@ +if exists("b:did_ftplugin") + finish +endif + +" Behave just like Ruby +runtime! ftplugin/ruby.vim + diff -r 3346aa8d5364 -r 31d00503e038 specky/plugin/specky.vim --- a/specky/plugin/specky.vim Fri Apr 03 23:34:00 2009 +0000 +++ b/specky/plugin/specky.vim Mon Apr 20 00:57:06 2009 +0000 @@ -5,7 +5,6 @@ " $Id$ " -" }}} " Hook up the functions to the user supplied key bindings. {{{ " if exists( 'g:speckySpecSwitcherKey' ) @@ -28,7 +27,6 @@ execute 'map ' . g:speckyRunRdocKey . ' :call RunRdoc()' endif - if exists( 'specky_loaded' ) finish endif @@ -152,11 +150,12 @@ function! MakeBanner() let l:banner_text = toupper(join( split( getline('.'), '\zs' ), ' ' )) let l:banner_text = substitute( l:banner_text, '^\s\+', '', '' ) - let l:sep = repeat( '#', 72 ) + let l:sep = repeat( '#', &textwidth == 0 ? 72 : &textwidth ) let l:line = line('.') call setline( l:line, l:sep ) call append( l:line, [ '### ' . l:banner_text, l:sep ] ) + execute 'normal 3==' call cursor( l:line + 3, 0 ) endfunction @@ -187,7 +186,7 @@ execute 'bd! ' . l:buf endif - execute ( exists('g:speckyVertSplit') ? 'vert new ' : 'new ') . l:buf + execute NewWindowCmd() . l:buf setlocal buftype=nofile bufhidden=delete noswapfile filetype=specrun set foldtext='--'.getline(v:foldstart).v:folddashes @@ -230,8 +229,8 @@ " If we aren't in a ruby file (specs are ruby-mode too) then we probably " don't care too much about this function. " - if ( &ft != 'ruby' && &ft != 'rdoc' ) - call s:err( "Not currently in ruby-mode." ) + if ( &ft != 'ruby' && &ft != 'rdoc' && &ft != 'rspec' ) + call s:err( "Not currently in a rubyish-mode." ) return endif @@ -266,7 +265,7 @@ " let l:word = substitute( l:word, ',', '', 'eg' ) - execute ( exists('g:speckyVertSplit') ? 'vert new ' : 'new ') . l:buf + execute NewWindowCmd() . l:buf setlocal buftype=nofile bufhidden=delete noswapfile filetype=rdoc nnoremap q :close @@ -317,6 +316,24 @@ endif endfunction +" }}} +" NewWindowCmd() {{{ +" +" Return the stringified command for a new window, based on user preferences. +" +function! NewWindowCmd() + if ( ! exists('g:speckyWindowType' ) ) + return 'tabnew ' + endif + + if ( g:speckyWindowType == 1 ) + return 'new ' + elseif ( g:speckyWindowType == 2 ) + return 'vert new ' + else + return 'tabnew ' + endif +endfunction " }}} " s:err( msg ) "{{{ diff -r 3346aa8d5364 -r 31d00503e038 specky/syntax/specrun.vim --- a/specky/syntax/specrun.vim Fri Apr 03 23:34:00 2009 +0000 +++ b/specky/syntax/specrun.vim Mon Apr 20 00:57:06 2009 +0000 @@ -25,7 +25,7 @@ " Pending specs (specdoc output) " -syntax match specPending /.*PENDING: Not Yet Implemented)/ contained +syntax match specPending /.*PENDING: .*)$/ contained highlight link specPending Function " " (Plain output)