diff -r 6b33188f1694 -r db3e3abfc647 specky/plugin/specky.vim --- a/specky/plugin/specky.vim Sun Mar 22 00:39:19 2009 +0000 +++ b/specky/plugin/specky.vim Sun Mar 22 00:49:45 2009 +0000 @@ -16,6 +16,10 @@ execute 'map ' . g:speckyQuoteSwitcherKey . ' :call QuoteSwitcher()' endif +if exists( 'g:speckyBannerKey' ) + execute 'map ' . g:speckyBannerKey . ' :call MakeBanner()' +endif + if exists( 'g:speckyRunSpecKey' ) execute 'map ' . g:speckyRunSpecKey . ' :call RunSpec()' endif @@ -39,6 +43,7 @@ execute 'menu ' . s:menuloc . '.Run\ &spec :call RunSpec()' execute 'menu ' . s:menuloc . '.&RDoc\ lookup :call RunRdoc()' execute 'menu ' . s:menuloc . '.Rotate\ "e\ style :call QuoteSwitcher()' +execute 'menu ' . s:menuloc . '.Make\ a\ &banner :call MakeBanner()' " }}} @@ -114,23 +119,23 @@ if l:type == '"' " Double quote to single " - execute ":normal viWs'" . l:word . "'" + execute ":normal viWc'" . l:word . "'" elseif l:type == "'" if &ft == "ruby" " Single quote to symbol " - execute ':normal viWs:' . l:word + execute ':normal viWc:' . l:word else " Single quote to double " - execute ':normal viWs"' . l:word . '"' + execute ':normal viWc"' . l:word . '"' end else " Whatever to double quote " - execute ':normal viWs"' . l:word . '"' + execute ':normal viWc"' . l:word . '"' endif " Move the cursor back into the cl:word @@ -140,6 +145,23 @@ " }}} +" MakeBanner() {{{ +" +" Create a quick banner from the current line's text. +" +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:line = line('.') + + call setline( l:line, l:sep ) + call append( l:line, [ '### ' . l:banner_text, l:sep ] ) + call cursor( l:line + 3, 0 ) +endfunction + + +" }}} " RunSpec() {{{ " " Run this function while in a spec file to run the specs within vim.